Recognizing the Arrival of a New File

Batista, Facundo FBatista at uniFON.com.ar
Tue Mar 8 10:08:53 EST 2005


[Greg Lindstrom]

#- 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 can check the date info of the directory:

fbatista at pytonisa ~> ll -d gsm
drwxr-xr-x    3 fbatista root         4096 feb 25  2004 gsm

fbatista at pytonisa ~> cd gsm
fbatista at pytonisa ~/gsm> touch w
fbatista at pytonisa ~/gsm> cd ..

fbatista at pytonisa ~> ll -d gsm
drwxr-xr-x    3 fbatista root         4096 mar  8 12:15 gsm

Regards,

.    Facundo

Bitácora De Vuelo: http://www.taniquetil.com.ar/plog
PyAr - Python Argentina: http://pyar.decode.com.ar/


  . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
ADVERTENCIA.

La información contenida en este mensaje y cualquier archivo anexo al mismo,
son para uso exclusivo del destinatario y pueden contener información
confidencial o propietaria, cuya divulgación es sancionada por la ley.
Si Ud. No es uno de los destinatarios consignados o la persona responsable
de hacer llegar este mensaje a los destinatarios consignados, no está
autorizado a divulgar, copiar, distribuir o retener información (o parte de
ella) contenida en este mensaje. Por favor notifíquenos respondiendo al
remitente, borre el mensaje original y borre las copias (impresas o grabadas
en cualquier medio magnético) que pueda haber realizado del mismo.
Todas las opiniones contenidas en este mail son propias del autor del
mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones
Personales S.A. o alguna empresa asociada.
Los mensajes electrónicos pueden ser alterados, motivo por el cual
Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación
cualquiera sea el resultante de este mensaje.
Muchas Gracias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20050308/8cad0f56/attachment.html>


More information about the Python-list mailing list