Skip to content

Instantly share code, notes, and snippets.

@OiCkilL
Last active February 24, 2018 07:34
Show Gist options
  • Select an option

  • Save OiCkilL/c2d5adeecb321357a131374d2d7a1abc to your computer and use it in GitHub Desktop.

Select an option

Save OiCkilL/c2d5adeecb321357a131374d2d7a1abc to your computer and use it in GitHub Desktop.
DeleteEmptyFolders.bat
@echo off
set target=%1
if not defined target (
goto :usage
)
for /f "usebackq delims=^" %%j in (`"@dir /ad/b/s %target% | sort /r"`) do (
rd %%j 2>NUL
)
echo All empty folders under %target% has been deleted.
goto :EOF
:usage
echo Example: %~n0 [target_folder]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment