Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CURL.SetOptionWildCardMatch

Enable wildcard matching.

Component Version macOS Windows Linux Server iOS SDK
CURL 5.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionWildCardMatch"; curl; Value )   More

Parameters

Parameter Description Example
curl The CURL session handle. $curl
Value The new setting. Can be 1 (on) or 0 (off). 1

Result

Returns OK or error.

Description

Enable wildcard matching.
Set parameter to 1 if you want to transfer multiple files according to a file name pattern. The pattern can be specified as part of the OptionURL option, using an fnmatch-like pattern (Shell Pattern Matching) in the last part of URL (file name).

By default, libcurl uses its internal wildcard matching implementation.

A brief introduction of its syntax follows:

  • - ASTERISK

ftp://example.com/some/path/*.txt (for all txt's from the root directory)

? - QUESTION MARK

Question mark matches any (exactly one) character.

ftp://example.com/some/path/photo?.jpeg

[ - BRACKET EXPRESSION

The left bracket opens a bracket expression. The question mark and asterisk have no special meaning in a bracket expression. Each bracket expression ends by the right bracket and matches exactly one character. Some examples follow:

[a-zA-Z0-9] or [f-gF-G] - character interval
[abc] - character enumeration
[^abc] or [!abc] - negation
[[:name:]] class expression. Supported classes are alnum,lower, space, alpha, digit, print, upper, blank, graph, xdigit.
[][-!^] - special case - matches only '-', ']', '[', '!' or '^'. These characters have no special purpose.
[\[\]\\] - escape syntax. Matches '[', ']' or '´.

Using the rules above, a file name pattern can be constructed:

ftp://example.com/some/path/[a-z[:upper:]\\].jpeg

This feature is only supported for FTP download.

See also WILDCARDMATCH option in CURL manual.

Examples

Enable wildcard match:

MBS( "CURL.SetOptionWildCardMatch"; $curl; 1 )

Download several files via FTP:

Set Variable [$curl; Value:MBS("CURL.New")]
#Set URL with wildcard match
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; CURL Test::URL)]
#Set folder where to put files
Set Variable [$result; Value:MBS("CURL.SetBatchDestinationPath"; $curl; CURL Test::DestPath)]
#credentials...
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password)]
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; CURL Test::Name)]
#enable wildcard match
Set Variable [$result; Value:MBS("CURL.SetOptionWildCardMatch"; $curl; 1)]
#download them all
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
#check results
Set Field [CURL Test::debug; MBS("CURL.GetDebugMessages"; $curl)]
Set Field [CURL Test::FileNames; MBS("CURL.GetBatchFileNames"; $curl)]
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]

See also

Example Databases

Created 8th July 2015, last changed 19th April 2020


CURL.SetOptionWebSocketOptions - CURL.SetOptionXOAuth2Bearer