From: Walter Szewelanczyk Date: 2005-02-08T04:45:22+09:00 Subject: Re: Need to create zip files > > RubyZip's docs do not have a "hey! this is how you use this to make a zip" > explanation and the methods aren't really documented - just source code is > shown. Anyone have examples or other docs? > The following creates a zip dynamically, but you could traverse the file system and do the same thing if you need. hth, Walt require 'zip' Zip::ZipOutputStream.open("c:/zip_test.zip") do |zos| zos.put_next_entry("dir_1") zos.puts "Hello " * 1000 zos.put_next_entry("dir_2") zos.puts "Hello again" zos.put_next_entry("dir_1/sub_dir_1") zos.puts "boo!"*10 end Zip::ZipInputStream.open("c:/zip_test.zip") do |zis| while e = zis.get_next_entry puts "*******************************************************" puts "#{e.name}, orig = #{e.size}, compressed = #{e.compressed_size}" puts zis.read end end -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.5 - Release Date: 2/3/2005