Skip to content

Instantly share code, notes, and snippets.

@jeffkreeftmeijer
Created May 25, 2010 15:35
Show Gist options
  • Select an option

  • Save jeffkreeftmeijer/413275 to your computer and use it in GitHub Desktop.

Select an option

Save jeffkreeftmeijer/413275 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'zip/zip'
id = "123"
files = %w(file1.txt file2.txt)
Zip::ZipFile.open("#{id}.zip", Zip::ZipFile::CREATE) do |zipfile|
files.each do |file|
zipfile.get_output_stream("#{id}/#{file}") { |f| f.puts file }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment