Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell when another process has stopped writing to a file in Perl?

Tags:

file

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.

like image 270
Xetius Avatar asked Dec 08 '22 08:12

Xetius


1 Answers

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.

like image 150
MarkR Avatar answered Dec 11 '22 12:12

MarkR