DOS delete files command question

M

Matt

I want to delete all files under C:\temp, but C:\temp has many
subdirectories too.

I first go to C:\temp in command line, and del *.*, but it only deleted the
files, not files in the subdirectories. Also, it showed Are you sure (Y/N)?
question. How to disable the question and set default yes.

If I want to put this task in batch file, the following won't work at all.

cd C:/temp
del *.*

any ideas? thanks!!
 
N

Norm Cook

In the Cmd window type del /? which will enumerate the switches.
You want del /R /Q c:\temp\*.*
This will not, however remove the empty directories
For that you need RD (remove directory)
 
N

Norm Cook

It also appears that DelTree is no longer provided with 2K/XP, but the
RD command has been souped up to include the /S /Q switches
so you can do it all in one swell foop.

RD /?

Removes (deletes) a directory.

RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path

/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.

/Q Quiet mode, do not ask if ok to remove a directory tree with /S
 

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