This script shows you the basics of decompressing a file. The rubyzip library does all of the work for you. On a standard Unix-like system, you would have to manually unzip the file, carry out your task, and then re-compress the file. With rubyzip, you can work with files in an archive using one seamless library. This script completely decompresses an archive into the user-specified directory.
require 'zip/zip' require 'fileutils' unless ARGV puts "Usage: ruby decompress.rb <zipfilename.zip>" puts "Example: ruby decompress.rb myfile.zip" exit end archive = ARGV.chomp if File.exists?(archive) ...