Skip to content

Instantly share code, notes, and snippets.

@xarimanx
Created October 13, 2015 15:08
Show Gist options
  • Save xarimanx/f4293403ffc7da374e91 to your computer and use it in GitHub Desktop.
Save xarimanx/f4293403ffc7da374e91 to your computer and use it in GitHub Desktop.
extract zip
Zip::ZipFile.open(file_path) do |zip_file|
zip_file.each do |f|
f_path=File.join("destination_path", f.name)
FileUtils.mkdir_p(File.dirname(f_path))
zip_file.extract(f, f_path) unless File.exist?(f_path)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment