Skip to content

Instantly share code, notes, and snippets.

@sebastjan-hribar
Created January 24, 2015 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastjan-hribar/7cd58e41ae7eb1cc3fb9 to your computer and use it in GitHub Desktop.
Save sebastjan-hribar/7cd58e41ae7eb1cc3fb9 to your computer and use it in GitHub Desktop.
# 4. Zip the files again
def zip_dir
directory = "test/"
zipfile_name = "test2.zip"
Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|
Dir[File.join(directory, '**', '*')].each do |file|
zipfile.add(file.sub(directory, ''), file)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment