Skip to content

Instantly share code, notes, and snippets.

@quwubin
Created March 25, 2014 01:17
Show Gist options
  • Save quwubin/9753549 to your computer and use it in GitHub Desktop.
Save quwubin/9753549 to your computer and use it in GitHub Desktop.
Delete the empty directory
#!/usr/bin/env ruby
Dir.foreach('./') do |dir|
next unless File.directory?(dir)
next if ['.', '..'].include?(dir)
if Dir.entries(dir) == ['.', '..']
Dir.delete(dir)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment