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

DESCRIPTION

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

DEFAULT

35       0, disabled
36

PROTOCOLS

38       FTP, SFTP and POP3
39

EXAMPLE

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

AVAILABILITY

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

RETURN VALUE

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

SEE ALSO

62       CURLOPT_CUSTOMREQUEST(3),
63
64
65
66libcurl 7.85.0                   May 17, 2022           CURLOPT_DIRLISTONLY(3)
Impressum