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

NAME

6       CURLOPT_DIRLISTONLY - ask for names only in a directory listing
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL *handle, CURLOPT_DIRLISTONLY, long lis‐
12       tonly);
13

DESCRIPTION

15       For FTP and SFTP based URLs a parameter set to 1 tells the  library  to
16       list  the  names of files in a directory, rather than performing a full
17       directory listing that would normally include file sizes, dates etc.
18
19       For POP3 a parameter of 1 tells the library to list the  email  message
20       or  messages on the POP3 server. This can be used to change the default
21       behavior of libcurl, when combined with a URL that contains  a  message
22       ID, to perform a "scan listing" which can then be used to determine the
23       size of an email.
24
25       Note: For FTP this causes a NLST command to be sent to the FTP  server.
26       Beware that some FTP servers list only files in their response to NLST;
27       they might not include subdirectories and symbolic links.
28
29       Setting this option to 1 also implies a directory listing even  if  the
30       URL doesn't end with a slash, which otherwise is necessary.
31
32       Do  NOT  use this option if you also use CURLOPT_WILDCARDMATCH(3) as it
33       will effectively break that feature then.
34

DEFAULT

36       0, disabled
37

PROTOCOLS

39       FTP, SFTP and POP3
40

EXAMPLE

42       CURL *curl = curl_easy_init();
43       if(curl) {
44         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/");
45
46         /* list only */
47         curl_easy_setopt(curl, CURLOPT_DIRLISTONLY, 1L);
48
49         ret = curl_easy_perform(curl);
50
51         curl_easy_cleanup(curl);
52       }
53

AVAILABILITY

55       This option was known as CURLOPT_FTPLISTONLY up to 7.16.4. POP3 is sup‐
56       ported since 7.21.5.
57

RETURN VALUE

59       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
60       if not.
61

SEE ALSO

63       CURLOPT_CUSTOMREQUEST(3),
64
65
66
67libcurl 7.79.1                 December 31, 2020        CURLOPT_DIRLISTONLY(3)
Impressum