02-20-05 11:20 PM
Claudius Zingerli wrote:
> Dear NG,
>
> Is there any way to get notified if someone moved a file into a
> directory? I'm searching for something like:
>
> handle=open(directory)
> ...
> rc=select(handle);
> if (rc>0) { do something }
>
> My target is to write a program A that "listens" on a directory (like a
> socket on a port). Another program B then moves a file into this
> directory. Program A notices this and processes this file.
>
> Does anyone know an API call or a solution for me? My program should run
> at least on FreeBSD but Linux would also be nice. Is there any common
> way to do that?
I think there is no common (at least no standard) way to monitor
a directory for changes.
Since this is a common problem, there are different solutions, though.
You could e.g.
o use FAM (File Access Monitoring)
o Solaris event ports (starting with Solaris 10)
Heiner
--
___ _
/ __| |_ _____ _____ _ _ Heiner STEVEN <heiner.steven@nexgo.de>
\__ \ _/ -_) V / -_) ' \ Shell Script Programmers: visit
|___/\__\___|\_/\___|_||_| http://www.shelldorado.com/
[ Post a follow-up to this message ]
|