Created
April 18, 2016 19:13
-
-
Save paulmars/285c33e3958aeb00d913c2b088c88ff9 to your computer and use it in GitHub Desktop.
delete empty directories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list directories | |
dirs = `du -h`.split("\n") | |
# get empty ones | |
empty_dirs = dirs.select{|d| d.split("\t").first.strip == "0B" } | |
# get only names | |
dir_names = empty_dirs.map{|d| d.split("\t")[1] } | |
# delete them | |
dir_names.each {|dir| `rmdir "#{dir}"` } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment