Skip to content

Instantly share code, notes, and snippets.

@zernel
Forked from Amitesh/unzip-folder.rb
Created November 12, 2013 06:20
Show Gist options
  • Save zernel/7426349 to your computer and use it in GitHub Desktop.
Save zernel/7426349 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'zip/zip'
def unzip_file (file, destination)
Zip::ZipFile.open(file) { |zip_file|
zip_file.each { |f|
f_path=File.join(destination, f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
}
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment