i am currently trying to clean up some folders and found this which seems to be just the thing i was looking for.
So i modified the limit, opened powershell and navigated to the desired folder and executed the .bat. Unfortunately i get the following message:
PS Z:\merle\Backup_HPLaptop\Manuel_01042023\FileHistory> .\powershell-delet_ding.bat
Z:\merle\Backup_HPLaptop\Manuel_01042023\FileHistory>$limit = (Get-Date).AddDays(-365)
'$limit' is not recognized as an internal or external command,
operable program or batch file.
Z:\merle\Backup_HPLaptop\Manuel_01042023\FileHistory>$path = 'Z:\merle\Backup_HPLaptop\Manuel_01042023\FileHistory'
'$path' is not recognized as an internal or external command,
operable program or batch file.
Z:\merle\Backup_HPLaptop\Manuel_01042023\FileHistory># Delete files older than the $limit.
'#' is not recognized as an internal or external command,
operable program or batch file.
Z:\merle\Backup_HPLaptop\Manuel_01042023\FileHistory>Get-ChildItem -Path $path -Recurse -Force | Where-Object { !$_.PSIsContainer -and $_.CreationTime -lt $limit } | Remove-Item -Force
'Get-ChildItem' is not recognized as an internal or external command,
operable program or batch file.
I have no idea why this isnt working since it is designed for powershell? Thanks!
I tried googling the error but it seems to be associated with paths ususally