Skip to content

Instantly share code, notes, and snippets.

@airspeed
Last active December 14, 2015 01:08
Show Gist options
  • Save airspeed/5003573 to your computer and use it in GitHub Desktop.
Save airspeed/5003573 to your computer and use it in GitHub Desktop.
Tut eine Liste beliebiger Dateien in ein Paket zusammenzippen.
require 'zip/zip'
def zip(zipfile_name, *input_filenames)
Zip::ZipFile.open(zipfile_name, Zip::ZipFile::CREATE) do |zipfile|
input_filenames.each do |filename|
zipfile.add(File.basename(filename), filename)
end
end
end
# usage:
# zip("/home/fpuglisi/Downloads/arkiv.zip", "/home/fpuglisi/Bilder/evloial-2560x1024.png", "/home/fpuglisi/Bilder/JLBB.mp3", "/home/fpuglisi/Bilder/GCMT9C.pdf")
# Clixxie::Archive::ClixxieZip.new.zip("/home/fpuglisi/Downloads/arkiv.zip", "/home/fpuglisi/Bilder/evloial-2560x1024.png", "/home/fpuglisi/Bilder/JLBB.mp3", "/home/fpuglisi/Bilder/GCMT9C.pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment