Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/12/2013, 08:04
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
Duda con respecto a pyinotify - Monitoreando sistemas de archivos

Hola amigos espero me puedan ayudar,

Me encuentro monitoreando un sistema de archivos y necesito el evento en el que termina de grabarse el archivo en disco

hasta el momento este es mi codigo, este funciona para cuando se crea el archivo
Código Python:
Ver original
  1. import pyinotify
  2.  
  3. class EventHandler(pyinotify.ProcessEvent):
  4.  
  5.     def process_IN_CREATE(self, event):
  6.         print "Creacion del archivo :", event.pathname
  7.     archivo = event.name
  8.     ruta = event.pathname
  9.     archi=open('datos.txt','a')
  10.     archi.write('archivo:'+ ' '+ event.name + ' ' + 'ruta:'+ ' '+ event.pathname)
  11.     archi.write('\n')
  12.         archi.close()
  13.  
  14. wm = pyinotify.WatchManager()
  15. mask = pyinotify.IN_CREATE
  16.  
  17. handler = EventHandler()
  18. notifier = pyinotify.Notifier(wm, handler)
  19. wdd = wm.add_watch('/resources', mask, rec=True)
  20. notifier.loop()