I have an application that runs on a windows server 2008 box. It watches a folder for files, when a file appears (ftp upload) the application tries to move it to another folder as a test to see if it is fully uploaded. The problem is that the file is not being locked by the FTP server and is able to be moved, this causes a failure as the file is only partially uploaded when it is moved. How can I stop access to the file during upload?
I would have the upload process create a second file, filename.lck, that would exist during the upload and be deleted after the upload is completed. Your application could then check for the presence of the .lck file instead of the actual file.