From: Dimitri Aivaliotis Date: 2006-03-17T23:43:52+09:00 Subject: Re: Delayed File I/O & ZLIB - Any help would be appreciated On 3/17/06, bcorrigan78@gmail.com wrote: > Ok, well I figured out part of the issue. The CSV file isn't being > written before the Zlib call. If I break this up into two scripts, the > first that writes the file, the second that zips it, things work. > > Any idea why the CSV file wouldn't be saved when the block ends? The CSV::Writer::generate doesn't implicity close the file you've opened in it's arguments. This file is not closed until the script exits, unless you explicity close the file, or open the file with a block. You might want to try something like: CSV.open(tempfile,"w+", ',') do |csv| Find.find(dirname) do |f| csv << [File.dirname(f), File.basename(f), File.mtime(f).to_s] end end Note: I haven't tested the above, just looked at 'ri CSV.open'. - Dimitri