On Thu, Jul 25, 2013 at 5:42 PM, Thomas Luedeke <lists / ruby-forum.com>wrote:

> Having trouble finding a sound method that doesn't break when waiting
> for a file to appear.  My initial approach was this:
>
> while File.exists?( "filename" ) == false
>    sleep( 5 )
> end
>
> This worked for a while, but doesn't seem to be robust.  I then tried
> this:
>
> until File.exists?( "filename" )
>    sleep( 5 )
> end
>
> Which also doesn't seem to work.
>
> I'm running Ruby 1.8.7. Is there a better way to do this?
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
Each OS family has its own system-level way of notifying programs when
files are added, removed, or changed. There are Ruby interfaces for the
Windows, Linux, and OS X methods; perhaps one of these gems would be of use?

For Windows: rb-fchange
For Linux: rb-inotify
For OS X: rb-fsevent