Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete all files while maintaining directory structure

Given the directory structure c:\a\b\c\d\ - what DOS command will delete all files contained in c:\a along with any files in the subdirectories b, c, and d? We do not want to delete any directories - just files.

like image 722
Marcus Leon Avatar asked Mar 26 '13 15:03

Marcus Leon


2 Answers

The DEL command only deletes files, not directories, so the following command will do as you asked:

DEL /S C:\a

You need to use RMDIR to remove directories.

like image 119
RB. Avatar answered Oct 02 '22 18:10

RB.


Use:

del *.* /s /q

Check the directories are still there:

tree
like image 27
diversemix Avatar answered Oct 02 '22 19:10

diversemix