Is there a better way to see if a file is being written to?
<p>We have a FreeBSD server with samba that employees copy image files on to, which then get uploaded to our web servers (this way they don't have to mess with ftp). Sometimes, if the upload script is running at the same time as files are being copied, it can upload an incomplete file. </p>

<p>We fixed this by getting the list of files along with the file sizes, then waiting 5 seconds and rechecking the file sizes. If the sizes match then its save to upload, if they don't match it checks again in another 5 seconds.</p>

<p>This seems like an odd way to check if the files are being written to. is there a better, more simple way of doing this?</p>
