From: Arup Rakshit Date: 2013-01-30T19:44:05+09:00 Subject: Re: Save a file by clicking on a link Joel Pearson wrote in post #1094173: > Arup Rakshit wrote in post #1094152: >> Is it possible to pause the next set of statements until the download is >> not being finished? > > I need to rewrite this at some point, it was a quick-fix and doesn't > currently have failsafes. Anyway, this is what I'm using: > > ____________ > > @download_directory = "#{Dir.pwd}/RubyDownloads" > @current_downloads = Dir.entries( @download_directory ) > > def wait_for_download > > #Find the newest file > difference = [1,2] > until difference.size == 1 > difference = Dir.entries(@download_directory) - @current_downloads > sleep 0.1 > end Can we rename the files during their download? -- Posted via http://www.ruby-forum.com/.