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 onoff);
12

DESCRIPTION

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

PROTOCOLS

63       This feature is only supported for FTP download.
64

EXAMPLE

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

AVAILABILITY

81       Added in 7.21.0
82

RETURN VALUE

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

SEE ALSO

88       CURLOPT_FNMATCH_FUNCTION(3), CURLOPT_URL(3),
89
90
91
92libcurl 7.85.0                   May 17, 2022         CURLOPT_WILDCARDMATCH(3)
Impressum