Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting directories

Status
Not open for further replies.

dljohnson69

IS-IT--Management
Oct 15, 2001
46
0
0
US
Is there a way to delete folders and files (a command within a batch file) without listing each folder name specifically? (Something like deltree)
 
Hi;

Use the /S option. This will recurse through subdirectories.

DEL *.BAK /S

Ed Please let me know if the sugestion(s) I provide are helpful to you.
Sometimes you're the windshield... Sometimes you're the bug.

 
The best way to delete/remove -everything- including files and subdirectories is to use:

RD "" /S

And to eliminate the "Are you sure" prompt:

RD "" /S /Q

You will see a msg "The system cannot find the path specified." when it is done but it is nothing to worry about. Just be sure to be IN the starting directory you want to begin deleting everything from. If you start in the root, you _will_ delete all files and directories on your drive.

This little trick gets files no matter what their properties are too - hidden, system and read-only. JSV
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top