Skip to content

Instantly share code, notes, and snippets.

@mofosyne
Created March 14, 2021 14:07
Show Gist options
  • Save mofosyne/0dceb2485dd384e2eb9e2f85cccfd774 to your computer and use it in GitHub Desktop.
Save mofosyne/0dceb2485dd384e2eb9e2f85cccfd774 to your computer and use it in GitHub Desktop.
Cleaning Up Empty folders in linux bash and windows batchfiles
# Tips in cleaning up empty folders
* https://stackoverflow.com/questions/30345690/git-how-to-remove-only-empty-directoriesnot-un-tracked-files-in-a-git-repo
* https://superuser.com/questions/444474/how-to-delete-empty-folders-from-a-given-directory-in-windows-with-a-script
In Linux bash
```
find . -empty -type d -delete
```
In Windows batchfile
```
for /f "delims=" %%i in ('dir /s /b /ad ^| sort /r') do rd "%%i"
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment