Trying to use forfiles to remove old files

nzoomed, Apr 23, 1:59am
Im trying to create a script to delete old backups on the backup drive since cobian wont do this automatically.
Im using the following command below with forfiles, but get the message "The system cannot find the file specified." Dont know whats going wrong.
forfiles -p "E:\Server Backups" -s -m *.* -d <3> -c "cmd /c del @path"

mrfxit, Apr 23, 4:17am
Yep sorry no help there but I presume you have backed up the back up drive 1st before "having a play "

king1, Apr 23, 5:07am
I had heap of grief with forfiles - just couldn't get it to behave

in the end I used robocopy to move to a temp dir then delete the dir

my script is this
robocopy "N:\SYSIMG\Nasty" "c:\tempPurge" /E /MINAGE:5 /MOVE /MT /XF "PurgeNastyBackup.bat&quo-
t; /LOG:"purgeNastyBackup.lo-

rd "c:\tempPurge" /S /Q

Only gotcha is that a move in robocopy terms takes as long as a copy, even on the same drive.
minage = days

nzoomed, Jan 20, 2:29am
Yeah, thats why i was a bit reluctant to use robocopy.

Might have to if i cant find any other solution.

Share this thread

Buy me a coffee :)Buy me a coffee :)