in reply to Check if file is written by other process

What is the process that is writing the files, and do you have any control over it? A few common approaches for writing the files are to use file locking (even advisory locking would help you), to use some kind of flag file, to rename/move the file once the write is done ... is anything like that possible? Also, exactly what filesystem is this on?

Perhaps lsof (Unix::Lsof) and its +D option could help you?

Replies are listed 'Best First'.
Re^2: Check if file is written by other process
by techman2006 (Beadle) on Jul 06, 2014 at 13:59 UTC

    Its an program which download files from some remote host. Also I can't control the way its right the data like writing a wrapper script etc.

    The machine is Linux based so I can use INotify functionality with out any issues.

      Is the program open or closed source, and can you tell us what it is called? Does the program's documentation say anything about using, for example, flock(2), which Perl supports? Can you contact the author(s) of the program to ask if it supports any locking or other control mechanisms? Lastly, I were you, I'd maybe try to test out if it uses some kind of locking without it being documented - again, lsof can help you find that out.