100
44
I have a directory on my Windows 7 machine that has hundreds if not thousands of sub-directories. Some of them have files, some do not. I want to delete all the empty directories.
Looking at the del and rmdir DOS command, it does not look like you can recursively do this without deleting all the files. Is there a way to do this from the command line?
1It can be done easily using ROBOCOPY. See my answer below for details. – Varun Sharma – 2015-10-16T18:48:40.573
I am amazed there's no simple answer to this question. – billpg – 2012-04-05T12:45:57.697
@billpg: simple as it could get:
– eckes – 2013-03-20T07:42:21.133xcopy FROMDIR TODIR /s
. See this SO answer: http://stackoverflow.com/a/147428101XCOPY deletes directories? – billpg – 2013-03-20T11:24:32.040