Skip to content

Instantly share code, notes, and snippets.

@jsnfwlr
Created December 17, 2019 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsnfwlr/8756f418e72a65d1539c50d8e0820c23 to your computer and use it in GitHub Desktop.
Save jsnfwlr/8756f418e72a65d1539c50d8e0820c23 to your computer and use it in GitHub Desktop.
# show the size of folders in current (non-recursive)
ls -1 | sed 's/ /\\ /g' | xargs du -sh
# show the size all folders below the current (recursive)
ls -1 | sed 's/ /\\ /g' | xargs du -h
# Remove empty folders - must be run a few times to work up the tree
ls -1 | sed 's/ /\\ /g' | xargs du -h | grep '4.0K' | awk '{$1=""; print $0}' | sed 's/^ //g; s/ /\\ /g' | xargs rm -rf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment