Option failonnomatch not working with filemask switch

Advertisement

boxrtoast
Joined:
Posts:
1

Option failonnomatch not working with filemask switch

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>

Reply with quote

Advertisement

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

Re: Option failonnomatch not working with filemask switch

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\

Reply with quote

Guest

Re: Option failonnomatch not working with filemask switch

martin 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?

Reply with quote

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

Re: Option failonnomatch not working with filemask switch

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.

Reply with quote

Advertisement

You can post new topics in this forum