Trying to use forfiles to remove old files

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"

geek_nzoomed, Apr 23, 1:59 pm

Yep sorry no help there but I presume you have backed up the back up drive 1st before "having a play "

geek_mrfxit, Apr 23, 4:17 pm

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

geek_king1, Apr 23, 5:07 pm

Yeah, thats why i was a bit reluctant to use robocopy.

Might have to if i cant find any other solution.

geek_nzoomed, Jan 20, 3:29 pm

Share this thread