Skip to content

Instantly share code, notes, and snippets.

@deejaygraham
Created May 6, 2014 12:19
Show Gist options
  • Save deejaygraham/9d82b1a03c869791236a to your computer and use it in GitHub Desktop.
Save deejaygraham/9d82b1a03c869791236a to your computer and use it in GitHub Desktop.
Clean a folder of empty sub-folders
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