I used this method to delete older files in forfiles /p "\\oradb-serv\DB_Backup\backup" /m *.dmp /c "cmd /c del @path" /d -3but it is not working
Hi Nallamki,
After looking over your ForFiles command to remove a file using the command prompt, it appears you are using the right set of instructions.
However, try arranging your command as mentioned below:
ForFiles /p "C:\PATH\TO\FOLDER" /s /d -3 /c "cmd /c del /q @file"
ForFiles options breakdown
The options used with the ForFiles command in this reference are described as follows:
/p — indicates the pathname to start searching.
/s — instructs ForFiles to search inside subdirectories.
/d — specifies the last modified date for a file.
/c — instructs ForFiles to execute command, which needs to be wrapped in double-quotes, the default is “cmd /c del @file”.
/q — allows to delete folders without requiring confirmation.