Parameters for WinSCP Script

Advertisement

Bpepsi
Joined:
Posts:
3

Parameters for WinSCP Script

Hi Gurus,

I want to copy files from my local system to the server and vice versa. After the coping I want to mark this files so that the files will not be transfered twice.

To have all informations central in one file I created a .bat file to store the necessary infos in MS-Dos variables. (f.e.: the username, hostname, ...)

It works fine to use this info for the connect. But now I have the problem on how to pass the infos to the WinSCP script. :( (f.e.: the folder where the transmitted filed should be stored)

Is there any way to pass parameters to the WinSCP script?

Thank you for your help.

Cheers,Barbara


---------------------------------------------
set_transfer_env.bat <-- Script to set the infos centrally

@ECHO OFF
rem ---- Server to Local
SET IN_SCRIPT=get_file.txt
SET IN_USERNAME=oracle
SET IN_HOST=asbudemo.at.oracle.com
SET IN_LOCAL_PATH=D:\incoming
SET IN_SERVER_PATH=/home/oracle/ingoing
SET IN_FILE_NAME=Bankfile.dat
rem ---- Local to Server
SET OUT_SCRIPT=put_file.txt
SET OUT_USERNAME=oracle
SET OUT_HOST=asbudemo.at.oracle.com
SET OUT_LOCAL_PATH=D:\outgoing
SET OUT_SERVER_PATH=/home/oracle/outgoing
SET OUT_FILE_NAME=Bankfile.dat

-----------------------------------------------------
start_get_file.bat <-- Script to call WinSCP

call set_transfer_env.bat
winscp3.exe /console /script=%IN_SCRIPT% %IN_USERNAME%:%1@%IN_HOST%
if errorlevel 1 goto error

echo Download succeeded
exit

:error
echo Download failed


------------------------------------------------------------
get_file.txt <-- WinSCP Script

option batch on
option confirm off
option transfer automatic
get /home/oracle/incoming/Bankfile.dat d:\outgoing\
close
exit

Reply with quote

Advertisement

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

Re: Parameters for WinSCP Script

You may generate the parametrized WinSCP script file or use /command option instead of /script.
_________________
Martin Prikryl

Reply with quote

Guest

Where to find info to parameterized scripts

Hi prikryl,

very many thanks to your reply. My problem is that i find no information how to make a parameterized WinSCP file. I cannot find anything in the doc.

The option with /command is also a good suggestion but it would be great if it would be possible to make it with a WinScp to make it more structured.

Thank you!

Cheers,
Barbara

Reply with quote

Guest

Wildcards don't work with WinScp Script

Hi,

I have the problem that the wildcard '*' does not work in my script. When I enter the concrete name of a file it works fine. But when I enter *.dat it returns with error. :/

Do you have any ideas?

Cheers,
Barbara

option batch on
option confirm off
option transfer automatic
get /home/oracle/incoming/*.dat d:\outgoing\
close
exit

Reply with quote

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

Re: Where to find info to parameterized scripts

Anonymous wrote:

very many thanks to your reply. My problem is that i find no information how to make a parameterized WinSCP file. I cannot find anything in the doc.
There's no support for that in WinSCP. But you can do that from batch file. There is some example for that in documentation.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum