From: sto.mar@... Date: 2013-02-01T22:16:36+09:00 Subject: Re: Save a file by clicking on a link Am 01.02.2013 11:49, schrieb Arup Rakshit: > OMG! Still not working. > > Dir.chdir("C:/Documents and Settings/rakshiar/My > Documents/userdata/Rubydownloads") do > > until Dir.glob('**/*.part*')[0] != [] > > sleep 0.1 > #puts "h" > > end > > Any better solution? It seems this couldn't stop the execution of next > line,until the download finished. I did not follow this thread, but I am pretty sure that the condition you are using does not test correctly what you want to find out. Consider that Dir.glob returns an array of filename strings, so that your condition *always* is true. (The first element will never be an empty array). A tiny change to the code will fix this... Furthermore, assuming that you want to sleep as long as the partial file *does* exists, you would also have to use `while' instead of `until' (or invert the condition). General tip: test the code snippet in isolation (using irb), with files you create or delete manually. --