Batch File Help

F

FJ

I'm trying to write a batch file to delete the contents of a directory on
the c drive and the subfolders with in it. In the old days I used DELTREE,
but I guess it isn't in XP/2000.

Can someone tell me how do delete the Folder1 and all it's contents:

C:\Folder1\pictures\open issue\*.jpg

Thanks.
 
G

Guest

I too am trying to write a batch file so I can delete the files and sub
directories under the temp folder (C:\Documents and Settings\user\Local
Settings\Temp) so I would really like to see how this is done.

All help is greatly appreciated.

~Olam
 
G

Guest

I still cannot get mine to work. This is what I have in my bat/cmd file
rmdir /S /Q "C:\Documents and Settings\Jeremy Johnston\Local
Settings\Temp\*.*"
I get the following error at the cmd prompt
The filename, directory name, or volume label syntax is incorrect.

At first I had it deleting all the files in the temp but it left all of the
sub directories. ???
 
T

Torgeir Bakken \(MVP\)

Olam said:
I still cannot get mine to work. This is what I have in my bat/cmd file
rmdir /S /Q "C:\Documents and Settings\Jeremy Johnston\Local
Settings\Temp\*.*"
I get the following error at the cmd prompt
The filename, directory name, or volume label syntax is incorrect.

At first I had it deleting all the files in the temp but it left all of the
sub directories. ???
Hi,

See tip 617 in the 'Tips & Tricks' at http://www.jsiinc.com/reghack.htm

DELTREE.BAT "c:\My Test Folder"

To delete files and sub directories under the temp folder:

DELTREE.BAT "%USERPROFILE%\Local Settings\Temp"


Deltree.bat contains:

@echo off
pushd %1
del /q *.*
for /f "Tokens=*" %%i in ('dir /B') do rd /s /q "%%i"
popd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top