Title / Description
Code #!/usr/bin/env ruby require 'fileutils' def delete_empty(path= ARGV[0]) Dir.foreach(path) do |all_directories| full_path = File.join(path,all_directories) if File.directory?(full_path) full_path.each_line do |all| next if all == '..' || all == '.' if Dir["#{all}/*"].empty? FileUtils.rmtree(all) puts "#{all} Deleted" end end end end end puts "Usage: #{__FILE__} dir " if ARGV.empty? delete_empty
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code