CURL.SetOptionWildCardMatch
---------------------------

Enable wildcard matching.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [5.2](newinversion52.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionWildCardMatch"; curl; Value ) 

**MBS**( **"CURL.SetOptionWildCardMatch";** /\* Enable wildcard matching. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* The new setting. Can be 1 (on) or 0 (off).e.g. 1 \*/ 

### 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](https://curl.haxx.se/libcurl/c/CURLOPT_WILDCARDMATCH.html) 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](CURLNew.md)")\]  
\#Set URL with wildcard match   
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; CURL Test::URL )\]  
\#Set folder where to put files   
Set Variable \[$result ; Value:MBS ("[CURL.SetBatchDestinationPath](CURLSetBatchDestinationPath.md)"; $curl ; CURL Test::DestPath )\]  
\#credentials...   
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionPassword](CURLSetOptionPassword.md)"; $curl ; CURL Test::Password )\]  
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionUserName](CURLSetOptionUserName.md)"; $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](CURLPerform.md)"; $curl )\]  
\#check results   
Set Field \[CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
Set Field \[CURL Test::FileNames ; MBS ("[CURL.GetBatchFileNames](CURLGetBatchFileNames.md)"; $curl )\]  
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
### See also

- [CURL.FileInfos](CURLFileInfos.md)
- [CURL.GetBatchFileNames](CURLGetBatchFileNames.md)
- [CURL.GetDebugMessages](CURLGetDebugMessages.md)
- [CURL.New](CURLNew.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.Release](CURLRelease.md)
- [CURL.SetBatchDestinationPath](CURLSetBatchDestinationPath.md)
- [CURL.SetOptionPassword](CURLSetOptionPassword.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)
- [CURL.SetOptionUserName](CURLSetOptionUserName.md)

### Example Databases

- [CURL/FTP/CURL FTP Directory Listing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/FTP/CURL%20FTP%20Directory%20Listing.shtml#1ScriptAnchor_)
- [CURL/FTP/CURL FTP Download all Files in Directory](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/FTP/CURL%20FTP%20Download%20all%20Files%20in%20Directory.shtml#2ScriptAnchor_)

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

  
[CURL.SetOptionWebSocketOptions](CURLSetOptionWebSocketOptions.md) - [CURL.SetOptionXOAuth2Bearer](CURLSetOptionXOAuth2Bearer.md)

[HTML Version](CURLSetOptionWildCardMatch.shtml)