Post a reply

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Hi Martin,
thank you for your response, much appreciated. It is FTP, sorry, I should have mentioned that.

I appreciate the link you sent, that confirms my suspicion that unfortunately there's no locking mechanism of any sort, so I ended up doing this:

Set a timer to scan the folder every 30 seconds. Compare the file timestamp with current time and if it is more than 2 minutes, the file gets processed, otherwise, it sits there until next round. So far, it seems to be working flawlessly.

Re: Incomplete files -- NOT a bug

What protocol? FTP? SFTP? Other?
Anyway, this is a common problem for which there's usually no good solution.
See my answer to a related question on Stack Overflow:
How to detect that a file is being uploaded over FTP

Incomplete files -- NOT a bug

Hello people,
I just discovered WinSCP and I'm slowly figuring out the details of how it works. Here's my situation. I have a device that stores files in a folder, fairly continuously. (with pauses of 2–5 minutes between batches of 10–20 files). The storage space on that device is rather small, so I was trying to figure out a way to download & delete. I did come with some code that works quite well, with one exception. If the file being downloaded via WinSCP is still in the process of being written by the device, I only get a partial file (only what's available at the time of download) and then the original gets downloaded.

So since I can delete the partial file, it's most likely not r/o or locked in any way, so I can't relay on that. Files are always different sizes, so I can't rely on size to know when it's done saving.

The only way I can think of to prevent that issue is to go with the timestamp on the file, and process it only if it's older than say 5 minutes, but that seems like a rather inefficient way to handle this.

Anyone have any suggestions?