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

Advertisement

manikandan23
Guest

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

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,226
Location:
Prague, Czechia

Re: using input parameter in get command to get specific files at run time

There's no set command in WinSCP, use:

get %1%*.*

Reply with quote

Advertisement

You can post new topics in this forum