I'm calling WinSCP from a batch file and using the get
command.
I want to download multiple files from a remote server with different file extensions and rename with timestamp on the local server.
As per the WinSCP get
help I tried using this syntax, but it does not work for me
"get /remote/*.XLSX *.PDF *.TXT \\local\*_%%TIMESTAMP#yyyymmddhhnnss%%.*"
But having multiple get commands does
"get /remote/*.XLSX \\local\*_%%TIMESTAMP#yyyymmddhhnnss%%.*"
"get /remote/*.PDF \\local\*_%%TIMESTAMP#yyyymmddhhnnss%%.*"
"get /remote/*.TXT \\local\*_%%TIMESTAMP#yyyymmddhhnnss%%.*"
It's not a big issue, but I wanted to confirm that this is only way to make it to work with timestamp in a simple batch file.
CodePudding user response:
You can specify multiple source parameters in the get
command. But they all need to be independent. So in your case, with a full path:
"get /remote/*.XLSX /remote/*.PDF /remote/*.TXT \\local\*_%%TIMESTAMP#yyyymmddhhnnss%%.*"
You can make it shorter, by changing remote working directory first:
"cd /remote" "get *.XLSX *.PDF *.TXT \\local\*_%%TIMESTAMP#yyyymmddhhnnss%%.*"