0

im trying to move every file in a directory to another when they are created. Maybe i could stop the daemon (pyinotify instance running) cleanly, and the original files continue to be created in the orig/spool directory.

I want to be processed after the daemon starts again. Maybe i can take advantage of the inotify kernel queues?

Thanks in advance

avances123
  • 2,224
  • 4
  • 21
  • 21

1 Answers1

1

You don't really want to move them as they're created, but rather as they're closed. Once they're closed (and nobody has any open file handles on them), you can consider them 'complete' and you can move them without any surprises.

You'll probably be good if you look for a 'close_write' event. (Although that doesn't guarantee that the file contains data or new data, you'd have to verify a modify->close_write event. But 99.99% of the time, close_write will do the job.

synthesizerpatel
  • 27,321
  • 5
  • 74
  • 91
  • Yea this is all true, i will catch the close_write events. My problem is in the start sequence, loop in the complete tree looking for files created (writeclosed) when the daemon is not running. – avances123 Jan 31 '12 at 19:03