0

I'm running a batch script that clears files, in which I need to delete all empty folders. It is identical to the question posted here: https://unix.stackexchange.com/questions/24134/remove-empty-directory-trees-removing-as-many-directories-as-possible-but-no-fi

except I am using batch instead of bash (Windows 10).

I tried using rmdir but it would either remove dirs. and files or remove nothing.

Mark Deven
  • 1,618
  • Right but if any of the folders has a file in it it does not delete any folders, including empty ones – Mark Deven May 08 '19 at 19:23
  • If you don't mind making a copy first, robocoy can copy subfolders that are not empty and skip those that are empty. Once the copy is done, the old folder can be removed, then the new copy can be renamed back. – LPChip May 08 '19 at 19:33
  • Interesting Workaround. What command would I use? – Mark Deven May 08 '19 at 19:42

0 Answers0