absk1317
12/25/2018 - 5:06 PM

Create zip archive of a folder with ruby

Create zip archive of a folder with ruby

require 'zip'
require 'zip/filesystem'

Zip::File.open(zip_path, Zip::File::CREATE) do |zipfile|
  Dir[File.join(directory_to_be_zipped, '*')].each do |file|
    zipfile.add(File.basename(file), file)
  end
end