Created
December 25, 2018 17:06
-
-
Save absk1317/12054fa70530a95e61e8e62d4650fb8e to your computer and use it in GitHub Desktop.
Create zip archive of a folder with ruby
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' | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment