Deletes Files and Directories, and all the Subdirectories and files in it.
To delete a directory and all the subdirectories and files contained therein:
DELTREE [/Y] directory
directory The directory to be deleted.
/Y Suppresses prompts for confirmation before
To delete all the files and subdirectories but leave the directory itself:
DELTREE [/Y] directory\*.*
To delete a file:
DELTREE [/Y] filename
The DELTREE command deletes all files contained in a directory or subdirectory, regardless of whether files are marked as hidden, system, or read-only.
The DELTREE command supports wildcards, but they should be used with some caution. If you specify a wildcard that matches both directory names and filenames, both the directories and files will be deleted.
Before specifying wildcards with the DELTREE command, use the DIR /A command to view the files and directories you will delete. It is also safest to specify the full path to avoid any surprises from ambiguous specification. Let us see some examples.
To delete the NOTES directory on drive C, including all files and subdirectories of the NOTES directory:
To delete all the files and subdirectories in the NOTES directory leaving an empty directory NOTES for future use, and avoiding the prompt for confirmation:
DELTREE /Y c:\notes\*.*
To delete the read-only file recover.doc in the c:\data directory without resetting the attributes:
DELTREE /Y c:\data\recover.doc
|Sample Chapters from book DATA RECOVERY WITH AND WITHOUT PROGRAMMING by Author Tarun Tyagi
Publishers of the Book
Number of Pages
Price of the Book
BPB Publications, New Delhi, India
$69.00 (Including Shipping Charges, Cost of Book and Other expenses, Free Source Code CD included with the Book)