On Sep 20, 11:15=A0pm, Tim Pease <tim.pe... / gmail.com> wrote:
> On Sep 20, 2008, at 7:17 PM, Junkone wrote:
>
> > is there any gem that will watch for a file and if the file exists, or
> > changes, can trigger process or event. =A0i am looking for something on
> > the windows platform only.
> > appreciate any help.
>
> Take a look at directory_watcher. It works on all platforms.
>
> http://codeforpeople.rubyforge.org/directory_watcher/
>
> Blessings,
> TwP

i tried as you suggested and have a few q.
i am trying to run a ruby prog to execute if there is any new file in
a directory. i started out with the examples but am a little confused
on how to useit.
this prog seems to be looking at the current directory where it is
running and not where i had specificed it to watch with dw.glob.

appreciate any help.

seede


require 'directory_watcher'
   dw =3D DirectoryWatcher.new '.', :pre_load =3D> true
   dw.glob =3D "c:\\temp\\scans\\" # is the directory i want to watch.
   dw.add_observer {|*args| args.each {|event| puts event}}
   dw.start
   gets
   dw.stop