Comment on page
FTP wildcard matching
libcurl supports FTP wildcard matching. You use this feature by setting
1Land then use a "wildcard pattern" in the in the file name part of the URL.
The default libcurl wildcard matching function supports:
To match all txt files in the directory
some/path. Only two asterisks are allowed within the same pattern string.
?- QUESTION MARK"
A question mark matches any (exactly one) character. Like if you have files called
photo7.jpegthis pattern could match them:
[- 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:
[f-gF-G]- character intervals
[abc]- character enumeration
[[:name:]]class expression. Supported classes are alnum, lower, space, alpha, digit, print, upper, blank, graph, xdigit.
[-!^]- special case, matches only
[\\[\\]\\\\]- escape syntax. Matches
Using the rules above, a file name pattern can be constructed:
When FTP wildcard matching is used, the
CURLOPT_CHUNK_BGN_FUNCTIONcallback is called before a transfer is initiated for a file that matches.
The callback can then opt to return one of these return codes to tell libcurl what to do with the file:
CURL_CHUNK_BGN_FUNC_OKtransfer the file
CURL_CHUNK_BGN_FUNC_FAILstop because of error
After the matched file has been transferred or skipped, the
CURLOPT_CHUNK_END_FUNCTIONcallback is called.
The end chunk callback can only return success or error.
If the default pattern matching function is not to your liking, you can provide your own replacement function by setting the
CURLOPT_FNMATCH_FUNCTIONoption to your alternative.