Last active
December 14, 2015 01:08
-
-
Save airspeed/5003573 to your computer and use it in GitHub Desktop.
Tut eine Liste beliebiger Dateien in ein Paket zusammenzippen.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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