Topic "using input parameter in get command to get specific files at run time"

Author Message
manikandan23

Guest


Hi,
I am trying to copy the specific files from remote sftp server. But my file name is passed as input parameter to my script which I will use in get command. My script is copied below and not bringing any files. I have files matching my parameter value in remote server. But my script does not bring files matching my input parameter value.

Typically my parameter values can take around 10 different values. We are not allowed to have 10 different scripts for 10 different file names.
If my input parameter value is GDE571FA, I want to copy the files GDE571FA*.* to my local.
Please help.

#
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect
open 1-aert-sftp-consume@aert.state.ri.us@internalsftp.ri.gov
pwd
# Change remote directory to <root>
cd ..
pwd
# Change remote directory
cd /TEST
pwd
# Force text mode transfer
option transfer binary
# Change local directory
lcd \\RIPETLP13VW\RIPW_Infa_PC_root\Scripts\EBT\Files\Mani
lpwd
echo %1%
set flenam=%1%
get %flenam%*.*

#
lpwd
ls
#
# Disconnect
close
# Exit WinSCP
exit
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
There's no set command in WinSCP, use:

get %1%*.*
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