Page 1 of 1

Script to delete files

Posted: 15 Sep 2010 12:17
by cartoonjunkie
Hello
I created a script that deletes files that are more then 8 days old this is the script

forfiles /p H:\DATA\SCANS\ /s /m *.* /d -8 /c "cmd /c del echo @FILE"

I am running this script on multiple servers and it works on all but one of them. On the server that the script fails on I get an error that it could not find

H:\DATA\SCANS\echo

Re: Script to delete files

Posted: 15 Sep 2010 12:30
by !k
cartoonjunkie wrote:del echo @FILE
maybe del @FILE :?:

Re: Script to delete files

Posted: 15 Sep 2010 15:03
by orange_batch
Why do you need to "cmd /c del echo @FILE" instead of just "cmd /c del @FILE"?

"del echo" doesn't make sense, it's trying to delete a file named echo.