Created
May 6, 2014 12:19
-
-
Save deejaygraham/9d82b1a03c869791236a to your computer and use it in GitHub Desktop.
Clean a folder of empty sub-folders
This file contains 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
Dir['**/*'] \ | |
.select { |d| File.directory?(d) } \ | |
.select { |d| (Dir.entries(d) - %w[ . .. ]).empty? } \ | |
.each { |d| Dir.rmdir d } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment