On Aug 19, 2008, at 7:45 PM, Matt Harrison wrote: >> In addition to print "\r" you might want to look at the docs for >> ProgressBar >> >> http://raa.ruby-lang.org/project/progressbar/ >> >> I can't remember where I used this or I'd drop an example in here, >> but >> it gives to a bar similar to what sftp or curl shows on downloads (it >> even gives a time to complete estimate). >> >> -Rob > > Excellent, first I managed to get it working as I said in my post, > thanks to Axel's link. Now I am trying the progress bar as Rob > suggested. It's good but I can't work out how the format is used. > > I'm trying to expand the amount of text displayed in the title so I > can > see the entire file and path. > > Any extra help is appreciated but thanks for what you've done so > far ;) > > Matt OK, here's the context: getting CSV files from a url and saving them locally begin File.open(csvfile, 'w') do |csvout| pbar = nil pbar_options = $stdout.tty? ? { :content_length_proc => lambda {|t| if t && 0 < t pbar = ProgressBar.new(csvfile, t) pbar.file_transfer_mode end }, :progress_proc => lambda {|s| pbar.set s if pbar }, } : { } open(url, pbar_options) do |csvurl| csvout.write csvurl.read end end # unless File.exist?(csvfile) rescue => e puts "\n** #{e}; #{e.message}" puts " skipping file" next end (I'm not boring you with all the setup to figure out the url and the subsequent processing of the CSV data into a database.) -Rob Rob Biedenharn http://agileconsultingllc.com Rob / AgileConsultingLLC.com