Method: Unpack#wipe!
- Defined in:
- lib/unpack.rb
#wipe! ⇒ Object
Removes the old rar and zip files
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/unpack.rb', line 126 def wipe! @removeable.each do |value| path = value.first type = value.last[:file_type] # Does not remove anything if nothing where unpacked next if value.last[:diff].empty? and not @options[:force_remove] puts "Removing files in #{path}" if @options[:debugger] # Finding every file in this directory Dir.glob(path + '/*').each do |file| # Is the found file as the same type as the one that got unpacked? FileUtils.rm(file) if Mimer.identify(file).send(:"#{type}?") end end end |