CURL.SetOptionDirListOnly
-------------------------

Whether to only query names in directory file listing.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionDirListOnly"; curl; Value ) 

**MBS**( **"CURL.SetOptionDirListOnly";** /\* Whether to only query names in directory file listing. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* Whether to limit directory listing to names only.e.g. 1 \*/ 

(old name: CURL.SetOptionFTPListOnly)

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | Whether to limit directory listing to names only. | 1 |

### Result

Returns "OK" on success.

### Description

Whether to only query names in directory file listing.  
A parameter set to 1 tells the library to just list the names of files in a directory, instead of doing a full directory listing that would include file sizes, dates etc. This works for FTP and SFTP URLs.  
  
This causes an FTP NLST command to be sent on an FTP server. Beware that some FTP servers list only files in their response to NLST; they might not include subdirectories and symbolic links.  
  
Please make sure the URL ends in a / to indicate a directory.  
See also [DIRLISTONLY](https://curl.haxx.se/libcurl/c/CURLOPT_DIRLISTONLY.html) option in CURL manual.

### Examples

List only file names:

 MBS ( "CURL.SetOptionDirListOnly"; $curl ; 1 )  
Full listing:

 MBS ( "CURL.SetOptionDirListOnly"; $curl ; 0 )  
Query list of files in FTP/SFTP folder:

 Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
\# set download URL, e.g. sftp://monkeybreadsoftware.net/   
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionURL](CURLSetOptionURL.md)"; $curl ; SFTP Download::URL )\]  
\# set credentials   
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionUserName](CURLSetOptionUserName.md)"; $curl ; SFTP Download::UserName )\]  
Set Variable \[$result ; Value:MBS ("[CURL.SetOptionPassword](CURLSetOptionPassword.md)"; $curl ; SFTP Download::Password )\]  
\# login only via password   
Set Variable \[$result ; Value:MBS ( "[CURL.SetOptionSSHAuthTypes](CURLSetOptionSSHAuthTypes.md)"; $curl ; 2+8 )\]  
\# only get list of file/dir names   
Set Variable \[$result ; Value:MBS ("CURL.SetOptionDirListOnly"; $curl ; 1)\]  
\# run transfer   
Set Field \[SFTP Download::ErrorCode ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
\# check debug log for errors   
Set Field \[SFTP Download::Debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
Set Field \[SFTP Download::FileList ; MBS ("[CURL.GetResultAsText](CURLGetResultAsText.md)"; $curl )\]  
\# free CURL session   
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
### See also

- [CURL.GetDebugMessages](CURLGetDebugMessages.md)
- [CURL.GetResultAsText](CURLGetResultAsText.md)
- [CURL.New](CURLNew.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.Release](CURLRelease.md)
- [CURL.SetOptionConnectOnly](CURLSetOptionConnectOnly.md)
- [CURL.SetOptionPassword](CURLSetOptionPassword.md)
- [CURL.SetOptionSSHAuthTypes](CURLSetOptionSSHAuthTypes.md)
- [CURL.SetOptionURL](CURLSetOptionURL.md)
- [CURL.SetOptionUserName](CURLSetOptionUserName.md)

### Example Databases

- [CURL/FTP/CURL FTP Directory Listing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/FTP/CURL%20FTP%20Directory%20Listing.shtml#1ScriptAnchor_)
- [CURL/FTP/CURL FTP Download all Files in Directory](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/FTP/CURL%20FTP%20Download%20all%20Files%20in%20Directory.shtml#5ScriptAnchor_)
- [CURL/SFTP/CURL sFTP Operations](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/SFTP/CURL%20sFTP%20Operations.shtml#4ScriptAnchor_)

### Blog Entries

- [SFTP Upload with temporary file](https://www.mbsplugins.de/archive/2023-03-06/SFTP_Upload_with_temporary_fil/monkeybreadsoftware_blog_filemaker)
- [Translating Insert from URL options for CURL to MBS Plugin calls](https://www.mbsplugins.de/archive/2020-12-14/Translating_Insert_from_URL_op/monkeybreadsoftware_blog_filemaker)

Created 18th August 2014 , last changed 19th December 2023

  
[CURL.SetOptionDefaultProtocol](CURLSetOptionDefaultProtocol.md) - [CURL.SetOptionDisallowUserNameInURL](CURLSetOptionDisallowUserNameInURL.md)

[HTML Version](CURLSetOptionDirListOnly.shtml)