Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 12.0   12.1   12.2   12.3   12.4   12.5   13.0   13.1   13.2   13.3    Statistic    FMM    Blog  


Whether to only query names in file listing.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.SetOptionDirListOnly"; curl; Value )   More

(old name: CURL.SetOptionFTPListOnly)


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


Returns "OK" on success.


Whether to only query names in 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 option in CURL manual.


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")]
# set download URL, e.g. s
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; SFTP Download::URL )]
# set credentials
Set Variable [$result; Value:MBS("CURL.SetOptionUserName"; $curl; SFTP Download::UserName )]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; SFTP Download::Password )]
# login only via password
Set Variable [$result; Value:MBS( "CURL.SetOptionSSHAuthTypes"; $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"; $curl)]
# check debug log for errors
Set Field [SFTP Download::Debug; MBS("CURL.GetDebugMessages"; $curl)]
Set Field [SFTP Download::FileList; MBS("CURL.GetResultAsText"; $curl)]
# free CURL session
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]

See also

Example Databases

Blog Entries

Created 18th August 2014, last changed 12nd April 2022

CURL.SetOptionDefaultProtocol - CURL.SetOptionDisallowUserNameInURL

💬 Ask a question or report a problem

Start Chat