Automatically resuming from where transfer stopped

Advertisement

smsmith57
Joined:
Posts:
3
Location:
Upstate New York

Automatically resuming from where transfer stopped

Hello. I saw a similar question in the forum, but it wasn't clear whether the problem has been resolved.

I have WinSCP version 5.13 running on Windows 8. I am transferring approximately 500MB sized files from a script. When the connection to the server is broken, WinSCP resumes transfer of the file. However, it doesn't appear to pick it where it left off. Instead, it seemingly starts transferring the entire file from the beginning. This process repeats until the entire file is successfully transferred or WinSCP finally gives up. I have tried both FTP and SFTP protocols. There have been no WinSCP upgrades. WinSCP is invoked from a .bat file as follows:

"C:\Program Files (x86)\WinSCP\WinSCP.exe" /log="C:\StreamRecordings\tools\WinSCP.log" /ini=nul /script="C:\StreamRecordings\tools\StreamRecordingsTransfer.txt"

The WinSCP script is:
# connect to FTP server
open ftp://name:password@server.org/
#open sftp://name:password@server.org/ -hostkey="ssh-rsa 2048 thekey"

# upload file
lcd E:\StreamRecordings\stagingArea
put -resume -filemask=*>50M *.mp4
#put *.mp4

# exit WinSCP
exit

I have attached a snippet of the log file. Interestingly, in the log at line number 79 it appears that WinSCP picks up where it left off, but if that were the case, I would expect that the entire file would eventually be transferred.

Another piece of information is that when FileZilla experiences the same disconnect, it restarts and picks up where it left off and will transfer the entire file. There are maybe 4 or 5 disconnects that it encounters.

Thanks for your help!

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: Automatically resuming from where transfer stopped

Thanks for your report.
Though the log file indeed shows a successful resuming of a transfer. The log file is truncated though. Did you delete a rest of the file? Can you post a complete log file that shows how "WinSCP finally gives up"?

Reply with quote

smsmith57
Joined:
Posts:
3
Location:
Upstate New York

Re: Automatically resuming from where transfer stopped

martin wrote:

Thanks for your report.
Though the log file indeed shows a successful resuming of a transfer. The log file is truncated though. Did you delete a rest of the file? Can you post a complete log file that shows how "WinSCP finally gives up"?

Thank you for the quick response. I have attached a complete log for which only a portion of the file was transferred to the server after almost an hour and a half of trying. Also attached is a screen shot of a terminal window showing a directory listing on the server. In that terminal window, I began entering periodic 'ls -al' commands about an hour after the FTP transfer started. Thanks for your help!

ServerScreenShot.png

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: Automatically resuming from where transfer stopped

OK, so it looks like your FTP server does save ongoing transfers to a temporary file name (.pureftpd-upload...). And sometimes, when a connection is lost, it won't rename the file. Or it takes some time before it renames the file. So when WinSCP reconnects, it sometimes won't find a partial file and starts over. I'm not sure there's anything WinSCP can do better. Maybe FileZilla was just lucky.

Reply with quote

Guest

Re: Automatically resuming from where transfer stopped

martin wrote:

OK, so it looks like your FTP server does save ongoing transfers to a temporary file name (.pureftpd-upload...). And sometimes, when a connection is lost, it won't rename the file. Or it takes some time before it renames the file. So when WinSCP reconnects, it sometimes won't find a partial file and starts over. I'm not sure there's anything WinSCP can do better. Maybe FileZilla was just lucky.

I'd have to think through how to do this, but if I don't specify 'resume' in the WinSCP script, check the file size when WinSCP completes, and then kick off WinSCP again if the file size is incorrect...would WinSCP then recognize a partial file and pick up where it left off? Thanks again for your help.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,540
Location:
Prague, Czechia

Re: Automatically resuming from where transfer stopped

I'd have to think through how to do this, but if I don't specify 'resume' in the WinSCP script, check the file size when WinSCP completes, and then kick off WinSCP again if the file size is incorrect...would WinSCP then recognize a partial file and pick up where it left off? Thanks again for your help.
It would, if you specify the -resume switch. No harm using it with the initial transfer either. -resume does not cause the automatic reconnect.

To disable the automatic reconnect, use Interface\SessionReopenAuto raw configuration:
https://winscp.net/eng/docs/rawconfig

Reply with quote

smsmith57
Joined:
Posts:
3
Location:
Upstate New York

Re: Automatically resuming from where transfer stopped

Resolved! And even easier than I thought. Using Interface\SessionReopenAuto with a value of 30000 did the trick. Thank you very much for your help!

Reply with quote

Advertisement

You can post new topics in this forum