Scripting : disabling resume option

Advertisement

marcvds
Guest

Scripting : disabling resume option

Hi,

I use WinSCP to transfer files to a protected SFTP server using the following script:

# Automatically answer all prompts negatively not to stall
# the script on errors
option batch on
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
# open user:password@example.com
# Connect
open xxxxxxxx:yyyyyyyy@xxx.xxx.xxx.xxx:xxxx-hostkey="ssh-dss 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
# Change remote directory
# cd /tmp/SFTP
# Force binary mode transfer
option transfer binary
# Upload the file to current working directory
put c:\Files\*.* 
# Disconnect
close
# Exit WinSCP
exit

I receive the following error in the log file:

* 2009-10-20 08:00:02.206 Error code: 4
* 2009-10-20 08:00:02.206 Error message from server (en): Failure
* 2009-10-20 08:00:02.206 Request code: 18
. 2009-10-20 08:00:02.206 Asking user:
. 2009-10-20 08:00:02.206 Transfer was succesfully finished, but temporary transfer file 'CAMDEF_20091019.csv.filepart' could not be renamed to target file name 'CAMDEF_20091019.csv'. If the problem persists, you may try to turn off transfer resume support. ("General failure (server should provide error description).

When using the WinSCP GUI, I overcome the problem by disabling the Enable transfer resume/transfer to temporary filename for in Endurance

My question is : how can I disable the resume/temporary filename option in scripts when using scripts?

My config is:
WinSCP 4.1.8 (Build 415)
Windows XP Pro SP3

Thanks for your help and congratulations for such a useful piece of software :D

Marc

Reply with quote

Advertisement

Nonnb
Guest

Re : disabling resume from Script

Hi Mark / prikryl

We have exactly the same problem - could you show exactly what you did to disable transfer to temporary file?

? Is this INI file used from the GUI (and configured with the Enable transfer resume/transfer to temporary file set to off

Thanks and Regards

Stuart

Reply with quote

martin
Site Admin
martin avatar

Re: Re : disabling resume from Script

Nonnb wrote:

? Is this INI file used from the GUI (and configured with the Enable transfer resume/transfer to temporary file set to off
Yes.

Reply with quote

Advertisement

vt
Guest

Turn off transfer resume support confusion

So I looked at the ini file and I'm still unsure how to turn off the temporary file setting. Is this a setting that's done on the GUI and then we can export the setting to an ini? If so, where is this done on the GUI? I looked in preferences under Transfer but don't see a switch?

Reply with quote

martin
Site Admin
martin avatar

Re: Turn off transfer resume support confusion

vt wrote:

If so, where is this done on the GUI? I looked in preferences under Transfer but don't see a switch?
Please read documentation. If that does not help, come back.

Reply with quote

vt
Guest

Turn off transfer resume support

I'm back. I read the documentation and it's a bit unclear to me what is needed in the ini.

Reply with quote

martin
Site Admin
martin avatar

Re: Turn off transfer resume support

vt wrote:

I'm back. I read the documentation and it's a bit unclear to me what is needed in the ini.
The format of INI file is not documented. If you want to find out what option is changed, just keep the ini file before making the change and compare against the one after the change.

Reply with quote

Advertisement

Ben4130
Guest

Re: Turn off transfer resume support

martin wrote:

vt wrote:

I'm back. I read the documentation and it's a bit unclear to me what is needed in the ini.
The format of INI file is not documented. If you want to find out what option is changed, just keep the ini file before making the change and compare against the one after the change.

I have tried selecting "Disable" in the "Enable transfer resume/transfer to temporary file" frame and then compared the before/after ini files but nothing has changed (the file's "date modified" value is updated but the text inside the file has not changed).

I have also tried changing the file size threshold to a larger value but this also doesn't seem to leave any changes.

I need to be able to disable the transfer resume without using the GUI.
Is there another way to do this?

Thanks

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: Turn off transfer resume support

Ben4130 wrote:

I have tried selecting "Disable" in the "Enable transfer resume/transfer to temporary file" frame and then compared the before/after ini files but nothing has changed (the file's "date modified" value is updated but the text inside the file has not changed).
It definitely works.
But anyway, I have added an example to the FAQ:
https://winscp.net/eng/docs/faq_script_ini

Reply with quote

Ben4130
Guest

Re: Turn off transfer resume support

martin wrote:

Ben4130 wrote:

I have tried selecting "Disable" in the "Enable transfer resume/transfer to temporary file" frame and then compared the before/after ini files but nothing has changed (the file's "date modified" value is updated but the text inside the file has not changed).
It definitely works.
But anyway, I have added an example to the FAQ:
https://winscp.net/eng/docs/faq_script_ini

Thanks :)
Don't know how I missed that line in the config in the first place.
BTW there is a small typo in the comments of the newly added part in the FAQ (it says ResumeSupport value should be 3 to disable but it should be 2).

Thanks again.

Reply with quote

martin
Site Admin
martin avatar

Re: Turn off transfer resume support

Ben4130 wrote:

BTW there is a small typo in the comments of the newly added part in the FAQ (it says ResumeSupport value should be 3 to disable but it should be 2).
Thanks. Fixed.

Reply with quote

Advertisement

professor_ape
Guest

thanks

answers here are fairly vague, but they were enough for me to work out what to do, so thanks!

For reference, the setting you want is 'ResumeSupport=2' (at least for the version of WinSCP I'm using, you might need to check for yourself).

In order to find this out, you first need to make sure INI files are enabled in the GUI options, then create one INI with the setting on and the setting off. I then used Notepad++ with the 'Compare' plugin, but you can use whatever method you want to find the difference between the two files.

As a side note, some documentation on these configurations might be nice to have.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
38,695
Location:
Prague, Czechia

Re: thanks

professor_ape wrote:

answers here are fairly vague, but they were enough for me to work out what to do, so thanks!

For reference, the setting you want is 'ResumeSupport=2' (at least for the version of WinSCP I'm using, you might need to check for yourself).

In order to find this out, you first need to make sure INI files are enabled in the GUI options, then create one INI with the setting on and the setting off. I then used Notepad++ with the 'Compare' plugin, but you can use whatever method you want to find the difference between the two files.

As a side note, some documentation on these configurations might be nice to have.
No need to hack an INI file for that. There's (documented) -resumesupport switch in commands like put, get, etc...
E.g.: https://winscp.net/eng/docs/scriptcommand_put#resumesupport

Reply with quote

NateD
Guest

Re: Turn off transfer resume support

Hey Martin - why do you have 'resume file transfer' turned on by default?

Seems like that is not desired in the majority of cases, so why force people to deal with .ini files (since there apparently are no command line args to do it) when scripting to turn it off?

It would also save you responding to endless "how do I disable resume file transfer' questions.

Reply with quote

Advertisement

Jeroaarts
Guest

Scripting resume support

More specifically, add an -resumesupport=off. It was not so hard to add this to this thread and it gives a simple and immediate answer to the OP.

Reply with quote

Advertisement

You can post new topics in this forum