I am developing an application which monitor an directory and once the files are written it perform some operations.
The use case is as below
- If a file is created when application is running I can get notification using INotify2. Also when file is closed after write is complete.
- If some file pre-exists then how to identify that all the write is complete.
- Let say I have a notification for file creation but next time when application is launched the file completed and closed. So the notification will be lost as the application was not running.
Now for use case 2 & 3 how I can know using Perl that file are not being used by other process for write operations and its complete. Also I don't know about the size of the files so we can't depend on the stats.