Created
April 4, 2014 06:27
-
-
Save adamwgriffin/9969228 to your computer and use it in GitHub Desktop.
A one-liner to recursively delete empty directories with Ruby
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
Dir['**/'].reverse_each { |d| Dir.rmdir d if Dir.entries(d).size == 2 } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This likely only works on a *nix flavored OS.