CURLOPT_WILDCARDMATCH.3 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_WILDCARDMATCH 3 "May 17, 2022" "libcurl 7.85.0" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_WILDCARDMATCH \- directory wildcard transfers
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_WILDCARDMATCH, long onoff);
  32. .fi
  33. .SH DESCRIPTION
  34. Set \fIonoff\fP to 1 if you want to transfer multiple files according to a
  35. file name pattern. The pattern can be specified as part of the
  36. \fICURLOPT_URL(3)\fP option, using an fnmatch-like pattern (Shell Pattern
  37. Matching) in the last part of URL (file name).
  38. By default, libcurl uses its internal wildcard matching implementation. You
  39. can provide your own matching function by the
  40. \fICURLOPT_FNMATCH_FUNCTION(3)\fP option.
  41. A brief introduction of its syntax follows:
  42. .RS
  43. .IP "* - ASTERISK"
  44. \&ftp://example.com/some/path/\fB*.txt\fP (for all txt's from the root
  45. directory). Only two asterisks are allowed within the same pattern string.
  46. .RE
  47. .RS
  48. .IP "? - QUESTION MARK"
  49. Question mark matches any (exactly one) character.
  50. \&ftp://example.com/some/path/\fBphoto?.jpeg\fP
  51. .RE
  52. .RS
  53. .IP "[ - BRACKET EXPRESSION"
  54. The left bracket opens a bracket expression. The question mark and asterisk have
  55. no special meaning in a bracket expression. Each bracket expression ends by the
  56. right bracket and matches exactly one character. Some examples follow:
  57. \fB[a-zA-Z0\-9]\fP or \fB[f\-gF\-G]\fP \- character interval
  58. \fB[abc]\fP - character enumeration
  59. \fB[^abc]\fP or \fB[!abc]\fP - negation
  60. \fB[[:\fP\fIname\fP\fB:]]\fP class expression. Supported classes are
  61. \fBalnum\fP,\fBlower\fP, \fBspace\fP, \fBalpha\fP, \fBdigit\fP, \fBprint\fP,
  62. \fBupper\fP, \fBblank\fP, \fBgraph\fP, \fBxdigit\fP.
  63. \fB[][-!^]\fP - special case \- matches only '\-', ']', '[', '!' or '^'. These
  64. characters have no special purpose.
  65. \fB[\\[\\]\\\\]\fP - escape syntax. Matches '[', ']' or '\\'.
  66. Using the rules above, a file name pattern can be constructed:
  67. \&ftp://example.com/some/path/\fB[a-z[:upper:]\\\\].jpeg\fP
  68. .SH PROTOCOLS
  69. This feature is only supported for FTP download.
  70. .SH EXAMPLE
  71. .nf
  72. /* initialization of easy handle */
  73. handle = curl_easy_init();
  74. /* turn on wildcard matching */
  75. curl_easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L);
  76. /* callback is called before download of concrete file started */
  77. curl_easy_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming);
  78. /* callback is called after data from the file have been transferred */
  79. curl_easy_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
  80. /* See more on https://curl.se/libcurl/c/ftp-wildcard.html */
  81. .fi
  82. .SH AVAILABILITY
  83. Added in 7.21.0
  84. .SH RETURN VALUE
  85. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  86. .SH "SEE ALSO"
  87. .BR CURLOPT_FNMATCH_FUNCTION "(3), " CURLOPT_URL "(3), "