Another system uses FTP to drop files in a directory for me to process.<br>I have a bash script to process the incoming files. The script is started by cron periodically.<br><br>There's a problem if the FTP transfer is still in progress because the process begins reading the file even though it isn't complete yet.<br>

<br>From a bash script, is there a way to tell if the file is still being written to?<br>I was looking at the lsof command, which will tell me if the file is opened or not, so that's a possibility... but it sure seems awkward for the task.<br>

<br>I could also configure the ftp server to lock files being written, but that seems to be discouraged. (based on man vsftpd.conf)<br><br>Basically, what I want is something like<br>Can I get an exclusive read on file x?<br>

No - skip that file, go onto the next one<br>Yes - start processing that file<br>(I'm not concerned about the possible race condition there... I have other protections for that)<br><br>Thanks for any suggestions...<br>

<br><br> <br>