I'd like to remove files and subdirectories that go 4 levels down after X days.
If the parent directory is X days old, then remove the subdirs. But if the parent directory is not X days old, don't taverse the files inside, which can have older files in that directory.
I have tried this which I found on another site. But it errors;
Error: No files found with the specified search criteria.
:: set folder path
:: set min age of files and folders to delete
:: remove files from %dump_path%
forfiles -p %dump_path% -m *.* -d -%max_days% -c "cmd /c del /q @path"
:: remove sub directories from %dump_path%
forfiles -p %dump_path% -d -%max_days% -c "cmd /c IF @isdir == TRUE rd /S /Q @path"
How can I do this please?