Last active
          September 28, 2023 13:06 
        
      - 
      
- 
        Save yoon/8876313 to your computer and use it in GitHub Desktop. 
    zip a folder with rubyzip
  
        
  
    
      This file contains hidden or 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 'rubygems' | |
| require 'zip' | |
| archive_directory_path = '' | |
| archive_zip_path = '' | |
| Zip::File.open( archive_zip_path, Zip::File::CREATE ) do |zip_file| | |
| Dir[ File.join( archive_directory_path, "**", "**" ) ].each do |file| | |
| zip_file.add( file.sub( "#{ archive_directory_path }/", "" ), file ) | |
| end | |
| end | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
@dharshan's link is broken. Here's an updated version we're using, though: