Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

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

There's no set command in WinSCP, use:

get %1%*.*
manikandan23

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