From: Sam Smoot Date: 2006-10-27T03:30:14+09:00 Subject: Re: Ruby fs watcher? Thomas Adam wrote: > On Fri, Oct 27, 2006 at 03:10:42AM +0900, Jean-Etienne Durand wrote: > > Hi, > > > > I wrote a script processing some files in a directory: each time there > > is a new file in a given directory, I do something. So, my problem here > > is to know when a new file arrived in the dir. > > What I do now is to try to open the file in exclusive mode and do not > > process the file if it fails, but polling just kills the cpu. > > > > I am wondering if somebody could explain me an elegant notification > > solution? > > If you're using Linux, you can use dnotify (and the newer 'anotify' > where applicable). I have no idea how Windows would handle such a > thing, if at all. > > -- Thomas Adam > > -- > "Wanting to feel; to know what is real. Living is a lie." -- Purpoise > Song, by The Monkees. You'd used WMI in Windows, potentially through the WIN32OLE library, to monitor for file events. The FileSystemWatcher class in .NET is just a wrapper around this functionality.