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

Carlangueitor gracias por responder, tienes razon queda mal identado al copiarlo

tienes algun aporte acerca del evento en el que termina de grabarse el archivo en disco ?

Código Python:
Ver original
  1. import pyinotify
  2.  
  3. class EventHandler(pyinotify.ProcessEvent):
  4.  
  5.     def process_IN_CLOSE_WRITE(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_CLOSE_WRITE
  16.  
  17. handler = EventHandler()
  18. notifier = pyinotify.Notifier(wm, handler)
  19. wdd = wm.add_watch('/resources', mask, rec=True)
  20. notifier.loop()