Skip to content

Instantly share code, notes, and snippets.

@Animeshjain2405
Forked from Amitesh/unzip-folder.rb
Last active August 29, 2015 14:15
Show Gist options
  • Save Animeshjain2405/1f8df81a96bc674790a2 to your computer and use it in GitHub Desktop.
Save Animeshjain2405/1f8df81a96bc674790a2 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