We are currently trying to transfer files using WinSCP SFTP protocol. We are having a problem with the vendor pulling the file before we are able to remove the .filepart extension. Does WinSCP lock the file during file transfer and when does it release it - when the file is completely transferred and the .filepart extension removed, or does it release it when the file is transferred and then attempt to pull it again to do the rename/stripping of the filepart extension?
Good question! Something I hadn't considered in my implementation.
Martin, keen to hear your response please :)
The best reference I could find is way back from the v3.2 release notes:
"Uploaded partial file (with .filepart extension) is renamed to target name only after file is closed (SFTP only). This should eliminate problems on servers, where file locking is supported (Windows)."
This seems to indicate that the file lock is very much an S/FTP server function, rather than a WinSCP option... Which makes sense.
WinSCP does not lock the file explicitly. Obviously particular implementation of the SFTP server may lock the file, when it is being accessed by SFTP client (WinSCP). It would be perfectly reasonable to do so.
SFTP client can lock the file explicitly with SFTP version 5. WinSCP does not support that yet. And note that the most widely used SFTP server, OpenSSH, does support SFTP version 3 only anyway.