Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

CURL.FileInfos

Queries file listing as JSON.

Component Version macOS Windows Linux Server iOS SDK
CURL 8.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.FileInfos"; curl )   More

Parameters

Parameter Description Example
curl The CURL session handle. $curl

Result

Returns JSON or error.

Description

Queries file listing as JSON.
Requires wild card being enabled (CURL.SetOptionWildCardMatch) and an URL with a pattern, e.g. * at the end.
Only for FTP protocol.

The JSON is an array of objects. Each object includes the following values:

hasFileNameWhether file name is known.
hasFiletypeWhether file type is known.
hasTimeWhether time is known.
hasPermWhether file permissions are known.
hasUIDWhether UID is known.
hasGIDWhether GID is known.
hasSizeWhether file size is known.
hasHardLinkCountWhether hard link count is known.
FileNameThe file name.
FileTypeThe file type. Usually file, directory or symlink.
TimeThe time as returned from server.
PermThe permissions as returned from server.
UserThe user name as returned from server.
GroupThe group name as returned from server.
TargetThe target file path of the symbolic link.
HardLinksThe number of hard links to this file.
SizeThe file size in bytes.
UIDThe user ID if known.
GIDThe group ID if known.
PermissionsThe file permissions as octal number as text, e.g. 755.
TimeValueThe unix time stamp.
YearThe year of the time, if available.
MonthThe month of the time, if available.
DayThe day of the time, if available.
HourThe hour of the time, if available.
MinuteThe minute of the time, if available.
SecondThe second of the time, if available.

As various servers return different listings, we can not always know all fields.
Some servers don't give the year, so we assume this year and last year depending on month and day.

For MBS Plugin 9.0 or newer you can alternatively run a custom request "MLSD" and then get file infos, too.

Examples

Query file list with wildcard:

Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $r ; Value: MBS( "CURL.SetOptionWildCardMatch"; $curl; 1 ) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; CURL Test::URL & "*" ) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUserName"; $curl; CURL Test::Name) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionVerbose"; $curl; 1) ]
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::listing ; MBS( "JSON.Colorize"; MBS("CURL.FileInfos"; $curl)) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugMessages"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]

Query file list with MLSD:

Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $r ; Value: MBS( "CURL.SetOptionWildCardMatch"; $curl; 1 ) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; CURL Test::URL & "*" ) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUserName"; $curl; CURL Test::Name) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionVerbose"; $curl; 1) ]
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::listing ; MBS( "JSON.Colorize"; MBS("CURL.FileInfos"; $curl)) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugMessages"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]

See also

Release notes

  • Version 9.0
  • Version 8.5

Example Databases

Blog Entries

This function checks for a license.

Created 16th October 2018, last changed 4th August 2023


CURL.Features - CURL.FormAddKeyContainer