CURLOPT_WILDCARDMATCH.3 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, 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 "16 Jun 2014" libcurl libcurl
  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 \fBfnmatch\fP-like pattern (Shell
  37. Pattern 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. .nf
  45. ftp://example.com/some/path/*.txt
  46. .fi
  47. for all txt's from the root directory. Only two asterisks are allowed within
  48. the same pattern string.
  49. .RE
  50. .RS
  51. .IP "? - QUESTION MARK"
  52. Question mark matches any (exactly one) character.
  53. .nf
  54. ftp://example.com/some/path/photo?.jpg
  55. .fi
  56. .RE
  57. .RS
  58. .IP "[ - BRACKET EXPRESSION"
  59. The left bracket opens a bracket expression. The question mark and asterisk have
  60. no special meaning in a bracket expression. Each bracket expression ends by the
  61. right bracket and matches exactly one character. Some examples follow:
  62. \fB[a-zA-Z0\-9]\fP or \fB[f\-gF\-G]\fP \- character interval
  63. \fB[abc]\fP - character enumeration
  64. \fB[^abc]\fP or \fB[!abc]\fP - negation
  65. \fB[[:name:]]\fP class expression. Supported classes are
  66. \fBalnum\fP,\fBlower\fP, \fBspace\fP, \fBalpha\fP, \fBdigit\fP, \fBprint\fP,
  67. \fBupper\fP, \fBblank\fP, \fBgraph\fP, \fBxdigit\fP.
  68. \fB[][-!^]\fP - special case \- matches only '\-', ']', '[', '!' or '^'. These
  69. characters have no special purpose.
  70. \fB[\\[\\]\\\\]\fP - escape syntax. Matches '[', ']' or '\e'.
  71. Using the rules above, a file name pattern can be constructed:
  72. .nf
  73. ftp://example.com/some/path/[a-z[:upper:]\\\\].jpg
  74. .fi
  75. .SH PROTOCOLS
  76. This feature is only supported for FTP download.
  77. .SH EXAMPLE
  78. .nf
  79. /* initialization of easy handle */
  80. handle = curl_easy_init();
  81. /* turn on wildcard matching */
  82. curl_easy_setopt(handle, CURLOPT_WILDCARDMATCH, 1L);
  83. /* callback is called before download of concrete file started */
  84. curl_easy_setopt(handle, CURLOPT_CHUNK_BGN_FUNCTION, file_is_coming);
  85. /* callback is called after data from the file have been transferred */
  86. curl_easy_setopt(handle, CURLOPT_CHUNK_END_FUNCTION, file_is_downloaded);
  87. /* See more on https://curl.se/libcurl/c/ftp-wildcard.html */
  88. .fi
  89. .SH AVAILABILITY
  90. Added in 7.21.0
  91. .SH RETURN VALUE
  92. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  93. .SH "SEE ALSO"
  94. .BR CURLOPT_FNMATCH_FUNCTION "(3), " CURLOPT_URL "(3), "