PDA

View Full Version : Slightly OT: Need syntax for simple batch file



rbmcgee
February 16th, 2007, 11:37 PM
Hi all,

I will be using girder to execute a batch file whenever the computer starts or wakes. I know how to get girder to execute this task. What I'm not clear on is the batch file itself.

I want the batch file to delete the folder C:\xxx\yyy\targetfolder\files. I don't need interaction or pauses or anything fancy. I just need the syntax to delete the folder (and obviously any contents). If the folder doesn't exist, fergetaboutit.

Running Win XP Home SP2

I've tried: DEL C:\xxx\yyy\targetfolder but that doesn't do it. Can someone provide the syntax.

Thanks in advance.

Rob H
February 17th, 2007, 02:47 AM
You want the RMDIR command I believe.

rbmcgee
February 17th, 2007, 08:00 AM
Thanks for the tip Rob.

I've discovered the answer. If any one else becomes interested:

rd /s /q "C:\xxx\yyy\targetfolder"

/s means delete the target folder and everything in it
/q means delete it without asking for confimation

Now when the computer starts or wakes up, that folder (and its contents) can be automatically deleted.