|Pathologically Eclectic Rubbish Lister|
Monitoring directory for new filesby ranciid (Novice)
|on Jan 20, 2010 at 04:28 UTC||Need Help??|
ranciid has asked for the
wisdom of the Perl Monks concerning the following question:
There's a directory (in Windows) that I have to monitor for new files created (sftp) there. Once it is created/dropped, I have to move (by sftp) it to another server for processing.
There is no fixed schedule when these files are created and there's no fixed file size either. The files can come immediately one after another in a "stream" or file by file over a period of time.
I have looked through perl modules "Win32::ChangeNotify", "File::Monitor::Simple" and "Dir-Watch" but I don't seem to be able to find where / how to find the filename of the newly created file.
Some concerns :
1) How do I avoid "race conditions"? If a big file happened to be created, how do I ensure that it is completely created before it is sftp-ed to the other processing server?
2) if the files come one after another, how should they be queued for processing?
Apologies for the lengthy maiden post as I am a complete newbie and I hope someone out there can help.Thanks in advance