Sha256: 1eb86e19b492bf18668c08e76c928e5abac16dfb248d86933dc1731488e5cff1
Contents?: true
Size: 524 Bytes
Versions: 17
Compression:
Stored size: 524 Bytes
Contents
class File # Clean out all the empty dirs def File.clean(file_name) if File.directory? file_name # clean all subdirs subdirs = Dir.entries(file_name).select { |p| File.directory?(File.join(file_name, p)) } subdirs.reject! { |p| %w{. ..}.include? p } subdirs.each { |sd| File.clean File.join(file_name, sd) } # if its empty then delete it contents = Dir.entries(file_name).reject { |p| %w{. ..}.include? p } Dir.delete file_name if contents.empty? end end end
Version data entries
17 entries across 17 versions & 2 rubygems