Topic "Option failonnomatch not working with filemask switch"

Author Message
boxrtoast
[View user's profile]

Joined: 2015-05-20
Posts: 1
Version is 5.7.3 (Build 5438)
The problem did not originate with upgrade. This is the first time using this feature.
OS is Windows 7 Enterprise
Transfer protocol is SFTP
I am using scripting.
I do not get any errors.

I expect WinSCP to report no match in the event a .835 file newer than one day is not found and return a non-zero exit code however it returns success. Removing the filemask switch causes the script to report no match if there are no .835 files. I need to know if there is a match newer than one day or not.

Here is the command line:
winscp.com /ini=nul /script=scriptFile /xmllog=logFile

Here is the script:
option batch on
option failonnomatch on
open sftp://user:password@sftp.server.com/ -hostkey="ssh-dss 1024 bb:e6:a2:bc:57:02:f6:38:85:6d:ca:b3:5a:f6:35:91"
get -filemask=">1D" "/835s/*.835" c:\users\username\desktop\

This is what I see running these commands in the console:
C:\Users\username>winscp.com
winscp> option batch on
batch on
reconnecttime 120
winscp> option failonnomatch on
failonnomatch on
winscp> open sftp://user:password@sftp.server.com/ -hostkey="ssh-dss 1024 bb:e6:a2:bc:57:02:f6:38:85:6d:ca:b3:5a:f6:35:91"
Searching for host...
Connecting to host...
Authenticating...
Using username "user".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] user@sftp.server.com
winscp> get -filemask=">1D" "/835s/*.835" c:\users\username\desktop\
winscp>
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
The failonnomatch indeed does not work for -filemask switch.

I have added this to the documentation:
https://winscp.net/eng/docs/scriptcommand_option

Anyway, there's no reason to use the -filemask switch for your particular needs. Just use:

get "/835s/*.835>1D" c:\users\username\desktop\
Guest




prikryl wrote:
The failonnomatch indeed does not work for -filemask switch.

I have added this to the documentation:
https://winscp.net/eng/docs/scriptcommand_option

Anyway, there's no reason to use the -filemask switch for your particular needs. Just use:

get "/835s/*.835>1D" c:\users\username\desktop\



Thanks for the clarification. In reading filemask documentation it doesn't seem clear to me when it would be appropriate to use the filemask switch versus putting the mask in the filename as you suggested. Would you explain?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Using an include mask in -filemask switch is indeed partially redundant to the "wildcard". But the -filemask switch allows also exclude masks and path-specific masks, or you can easily use it to download all files of certain type recursively.
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