Is there a clean or reliable way of checking to see if a file is still being written to before doing anything with it? Here's the scenario: we have a Samba share that we can copy files to (from within Windows or Macs). The server picks up the file and does some processing of said file. At the moment this is all a manual process: we copy a file into the Samba share, wait for that to finish then go to a web page (on the server) and tell it to process the file that was just copied into the Samba share. I'm trying to see if there is a way to automate this where a file, or multiple files, get copied into the share and the server picks them up and process automatically without needing any interaction. Can PHP detect this, or should I look into some delayed process of checking the file's modified time stamp versus current time and not touch the file till a certain threshold has been reached (say 30 seconds difference?). Ideas, suggestions, comments .