I am trying to delete files through
forfiles -p "E:\check" -s -m *.* -d -10 -c "cmd /c del /Q /S E:\check"
But if there is a file that is more than 10 days old, it removes all files in the folder.
I am trying to delete files through
forfiles -p "E:\check" -s -m *.* -d -10 -c "cmd /c del /Q /S E:\check"
But if there is a file that is more than 10 days old, it removes all files in the folder.
forfiles -p "E:\check" -s -m *.* -d -10 -c "cmd /c del /Q /S E:\check"
That is hardly surprising when you are deleting the directory you are searching (and all of its sub-directories) with the following command:
del /Q /S E:\check
Instead you need to delete the matching files. Try the following command:
forfiles -p "E:\check" -s -m *.* -d -10 -c "cmd /c del /q @path"