How to delete all folders in current directory

How to delete all folders in current directory using command line (cmd.exe) or batch files?

How to delete all empty directories in current folder:
FOR /D %f IN (*.*) DO RD "%f"

How to delete all directories / folders in current directory / folder:
FOR /D %f IN (*.*) DO RD "%f" /S /Q

If you are using FOR in batch file, you must use double % signs.
FOR /D %%f IN (*.*) DO RD "%%f" /S /Q

This entry was posted in OS, Programming and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>