1CURLOPT_WILDCARDMATCH(3)   curl_easy_setopt options   CURLOPT_WILDCARDMATCH(3)
2
3
4

NAME

6       CURLOPT_WILDCARDMATCH - directory wildcard transfers
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_WILDCARDMATCH,  long
12       onoff);
13

DESCRIPTION

15       Set onoff to 1 if you want to transfer multiple files  according  to  a
16       file  name  pattern.  The  pattern can be specified as part of the CUR‐
17       LOPT_URL(3) option, using an fnmatch-like pattern (Shell Pattern Match‐
18       ing) in the last part of URL (file name).
19
20       By default, libcurl uses its internal wildcard matching implementation.
21       You can provide your own matching function by the CURLOPT_FNMATCH_FUNC‐
22       TION(3) option.
23
24       A brief introduction of its syntax follows:
25
26              * - ASTERISK
27                     ftp://example.com/some/path/*.txt (for all txt's from the
28                     root directory). Only two asterisks  are  allowed  within
29                     the same pattern string.
30
31              ? - QUESTION MARK
32                     Question mark matches any (exactly one) character.
33
34                     ftp://example.com/some/path/photo?.jpeg
35
36              [ - BRACKET EXPRESSION
37                     The left bracket opens a bracket expression. The question
38                     mark and asterisk have no special meaning  in  a  bracket
39                     expression.  Each  bracket  expression  ends by the right
40                     bracket and matches exactly one character. Some  examples
41                     follow:
42
43                     [a-zA-Z0-9] or [f-gF-G] - character interval
44
45                     [abc] - character enumeration
46
47                     [^abc] or [!abc] - negation
48
49                     [[:name:]]  class  expression.  Supported classes are al‐
50                     num,lower, space,  alpha,  digit,  print,  upper,  blank,
51                     graph, xdigit.
52
53                     [][-!^]  - special case - matches only '-', ']', '[', '!'
54                     or '^'. These characters have no special purpose.
55
56                     [\[\]\\] - escape syntax. Matches '[', ']' or '\'.
57
58                     Using the rules above, a file name pattern  can  be  con‐
59                     structed:
60
61                     ftp://example.com/some/path/[a-z[:upper:]\\].jpeg
62

PROTOCOLS

64       This feature is only supported for FTP download.
65

EXAMPLE

67         /* initialization of easy handle */
68         handle = curl_easy_init();
69
70         /* turn on wildcard matching */
71         curl_easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L);
72
73         /* callback is called before download of concrete file started */
74         curl_easy_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming);
75
76         /* callback is called after data from the file have been transferred */
77         curl_easy_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
78
79         /* See more on https://curl.se/libcurl/c/ftp-wildcard.html */
80

AVAILABILITY

82       Added in 7.21.0
83

RETURN VALUE

85       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
86       if not.
87

SEE ALSO

89       CURLOPT_FNMATCH_FUNCTION(3), CURLOPT_URL(3),
90
91
92
93libcurl 7.79.1                September 08, 2021      CURLOPT_WILDCARDMATCH(3)
Impressum