Defining A Transfer Setting Preset Within A Console Script

Advertisement

Tom Purl
Guest

Defining A Transfer Setting Preset Within A Console Script

Hi, I've looked for about an hour for this information, so any help I can get would be greatly appreciated!

I have a custom transfer setting preset that I would like to use from within a console script. I looked at the Scripting/Automation page on the WinSCP wiki, but didn't find any help when it came to specifying transfer setting presets.

Is there a more verbose scripting reference available that tells me how to do this and other things such as comparison criterion?

Thanks!

Tom Purl

Reply with quote

Advertisement

tom purl
Joined:
Posts:
2

All right, I tried again, but I'm having a few problems.

I set up a default transfer setting preset. When I execute winscp3 using the gui and open the "mysession" session, I get a dialog that tells me that that the "Mydocs Backup" transfer setting preset was automatically selected. This transfer setting preset uses a username mask (myusername).

I can then choose "Commands -> Synchronize", choose my local and remote directories, click on OK, and my local directory is successfully copied to the remote directory.

Now I'm trying to do this via a batch file. Heres's my test.script file:

option batch on
option confirm off

# Set your options
option synchdelete on

synchronize remote "C:\Documents and Settings\myusername\My Documents" "/home/myusername/backups/My Documents"

# Exit WinSCP
close
exit

I then execute this script using the following command:

winscp3.exe myusername@myseerver /console /script=.\test.script

However, when I do this, it's clear that my default transfer setting preset is not being chosen. My default transfer setting excludes anything under the %MYDOCS%\Downloads directory, and this exclusion filter works when using the gui. From the command-line, the files under the Downloads directory are copied.

What am I missing in order to force the command-line to use my default transfer setting preset? Is there a way that I can inspect which transfer setting is being used?

Thanks in advance!

Tom Purl

Reply with quote

martin
Site Admin
martin avatar

Again, transfer setting presets are not used in scripts. But you can change the DEFAULT transfer settings via an INI file as is suggested in the FAQ.

Reply with quote

Advertisement

tom purl
Joined:
Posts:
2

martin wrote:

Again, transfer setting presets are not used in scripts. But you can change the DEFAULT transfer settings via an INI file as is suggested in the FAQ.

I'm not trying to define a transfer settting preset in the script listed above. I guess my problems is that I don't know how to define the default transfer setting via the ini file. The faq entry to which you refer only has the following regarding default transfer settings:

For transfer setting, you can pre-configure your preferred settings as default transfer settings. The script uses the default transfer settings as initial.

It doesn't tell me where to pre-configure my preferred default transfer setting. So then I re-checked your message and saw the following:

martin wrote:

But you can change the DEFAULT transfer settings via an INI file as is suggested in the FAQ.

But from what I can see, the faq page that you referenced doesn't show you how to do that. It shows you how to set default security settings and proxy hosts, but nothing about defining a default transfer setting preset.

Which ini file directive am I missing? I tried looking for a more verbose ini file reference for WinSCP, but couldn't find it?

Thanks for all of the help!

Tom Purl

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

tom purl wrote:

Which ini file directive am I missing? I tried looking for a more verbose ini file reference for WinSCP, but couldn't find it?
It is not documented (small example is at the very end of the FAQ). Just configure the default transfer settings from GUI. If you want to make sure that the script will behave the same even if you change the setting in GUI in future, make sure that configuration is stored into INI file and make a dedicated copy for the script and force its usage via /ini switch, as is shown in the FAQ.

Reply with quote

Advertisement

You can post new topics in this forum