Recognizing the Arrival of a New File
John Lenton
john at grulic.org.ar
Thu Mar 10 09:59:10 EST 2005
On Tue, Mar 08, 2005 at 08:43:04AM -0600, Greg Lindstrom wrote:
> I am writing an application where I need to recognize when a file
> arrives in a given directory. Files may arrive at any time during the
> course of the day. Do I set up a cron job to poll the directory every
> few minutes? Write a daemon to monitor the directory? Or is there some
> other more common/accepted way to perform this task? I'm using Python
> 2.3 on Linux.
you could use dnotify; unfortunately although the fcntl wrapper in
python would suffice, there is AFAIK no way to do
sigaction. Fortunately there is a dnotify program which is easy enough
to use, both from python or directly.
--
John Lenton (john at grulic.org.ar) -- Random fortune:
<Knghtbrd> 2fort5 sucks enough to have its own gravity ...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20050310/58cc521d/attachment.sig>
More information about the Python-list
mailing list