title: Compress a complete directory in Ruby with zlib?
body: <p>This is the code I'm trying.</p>
  
  <pre><code>require 'zlib'
  Dir.glob('*.*').each do |file|
    Zlib::GzipWriter.open('output.gz') do |gz|
      gz.mtime = File.mtime(file)
      gz.orig_name = File.basename(file)
      gz.write IO.binread(file)
    end
  end
  </code></pre>
  
  <p>I've tried different variations of this.  There doesn't seem to be a howto for "multiple files" online.  I keep ending up with the first file name in the ouput.gz, and I think it may have the content of the last file from the directory (not sure).  But that's besides the point.  I just want to put each file as separate entities in a compressed file.  The more cross platform compatible it is the better.</p>