Script to delete files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
cartoonjunkie
Posts: 1
Joined: 15 Sep 2010 12:06

Script to delete files

#1 Post by cartoonjunkie » 15 Sep 2010 12:17

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

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: Script to delete files

#2 Post by !k » 15 Sep 2010 12:30

cartoonjunkie wrote:del echo @FILE
maybe del @FILE :?:

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Script to delete files

#3 Post by orange_batch » 15 Sep 2010 15:03

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.

Post Reply