Topic "Parameters for WinSCP Script"

Author Message
Bpepsi
[View user's profile]

Joined: 2007-03-08
Posts: 3
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. Sad (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
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
You may generate the parametrized WinSCP script file or use /command option instead of /script.
_________________
Martin Prikryl
Guest




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
Guest




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
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
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
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License