link: http://www.markhneedham.com/blog/2008/10/02/ruby-unzipping-a-file-using-rubyzip/

 

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

 

相关文章:

  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-09-11
  • 2022-02-15
猜你喜欢
  • 2022-12-23
  • 2022-02-02
  • 2021-11-20
  • 2021-12-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案