How do I know when another process has stopped writing to a file in Perl?


I have a system which is writing files to a folder using FTP. I need to copy those files, but only when they FTP system has finished. How do I tell when the first process has finished writing.

Another possibility is to have the process which uploads the files upload them under a temporary name and then rename them.

Renames happen atomically so there would be no case where the file was incomplete under its final name.

The copying process could ignore the temporary named files.