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

NoviceUser2018

Re: Wildcard Character Using WinSCP.com

NoviceUser2018 wrote:

martin wrote:

Why do you even call the stat?


Hi Martin, I'am using stat so I can capture a message in the XML log when a file was not found. Please let me know if there is an alternative to using stat to get a comprehensive list in the XML log file - without having to go the dll route. Also if there are any other error/message log options/commands I can use.

Failonnomatch on
option produces a "unknown option 'failonnomatch'" error.


Just realized that the failonnomatch is a version issue. With the latest version of WinSCP.com portable, it works perfectly. Thanks!
NoviceUser2018

Re: Wildcard Character Using WinSCP.com

martin wrote:

Why do you even call the stat?


Hi Martin, I'am using stat so I can capture a message in the XML log when a file was not found. Please let me know if there is an alternative to using stat to get a comprehensive list in the XML log file - without having to go the dll route. Also if there are any other error/message log options/commands I can use.

Failonnomatch on
option produces a "unknown option 'failonnomatch'" error.
martin

Re: Wildcard Character Using WinSCP.com

Why do you even call the stat?
NoviceUser2018

Re: Wildcard Character Using WinSCP.com

NoviceUser2018 wrote:

I have a simple script that needs to be automated. This script runs perfectly when I replace the * (wildcard character) with the actual filename. But throws a "No such file" error when using the *

Here's the script I'm currently using:

option batch abort

option confirm off
open sftp://MyUserName:MyPassword@URL:PortNumber -hostkey="HostkeyHere"
stat /dirName/*.enc
get /dirName/*.enc  c:\Users\MyUserName\Desktop\
close
exit


I call this from a windows batch script with this command in it:

winscp.com /ini=nul /script=C:\Users\MyUserName\Desktop\tstSftp\TestSFTP.txt /xmllog=C:\Users\MyUserName\Desktop\tstSftp\logSFTPTest.xml /loglevel=2



I searched for any similar existing issues on the forums, but I couldn't find one. I'm stuck. Please help.


I just realized that Stat cannot be used with a wildcard character. And that's what is causing the error. Is there any way to check if a file extension exists using winscp.com script without using the WinscpNet libraries?
NoviceUser2018

Wildcard Character Using WinSCP.com

I have a simple script that needs to be automated. This script runs perfectly when I replace the * (wildcard character) with the actual filename. But throws a "No such file" error when using the *

Here's the script I'm currently using:

option batch abort

option confirm off
open sftp://MyUserName:MyPassword@URL:PortNumber -hostkey="HostkeyHere"
stat /dirName/*.enc
get /dirName/*.enc  c:\Users\MyUserName\Desktop\
close
exit


I call this from a windows batch script with this command in it:

winscp.com /ini=nul /script=C:\Users\MyUserName\Desktop\tstSftp\TestSFTP.txt /xmllog=C:\Users\MyUserName\Desktop\tstSftp\logSFTPTest.xml /loglevel=2



I searched for any similar existing issues on the forums, but I couldn't find one. I'm stuck. Please help.