From: Arup Rakshit Date: 2013-02-01T22:43:18+09:00 Subject: Re: Save a file by clicking on a link unknown wrote in post #1094748: > Am 01.02.2013 11:49, schrieb Arup Rakshit: >> 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. Yes! Exactly this I have followed and made the code working: One change I did- until Dir.glob('**/*.part*')== [] sleep 0.1 #puts "h" end Now all are set, for GOD sake:) Thanks to all of you! You people are really love Ruby- which is proved by your continuous suggestions. It seems I started to fall in love with "Ruby" :-P -- Posted via http://www.ruby-forum.com/.