Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Thanks. Found that this only applies to commandline not batchfiles. According to superuser.com/questions/444474/… by Dennis, if we want to use this in a batchfile it should be for /f "delims=" %%i in ('dir /s /b /ad ^| sort /r') do rd "%%i". The for behaviour is slightly different between commandline and batchfiles.
    – Brian
    Commented Mar 10, 2021 at 22:21
  • This does not work for me when I have nested empty folders. I think it starts at the top of the hierarchy, so the folders aren't empty. You could just run it repeatedly until it gets them all, though.
    – ChaosFreak
    Commented Aug 7, 2022 at 1:22