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:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Queries list of file names in folder as JSON.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Files | 10.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
Path | Native path to the directory. | "C:\Test" | |
Keys | The keys to retrieve. Pass a list of values including Size, CreationTimeStamp, AccessTimeStamp, ModificationTimeStamp, Visible. Name, Directory and Type can be passed, but are always included. If keys is "All", we include all keys. |
Optional | |
filter | Optional, limits what is returned. Default is 0 to report all files. Pass a combination of 1 for showing only files, 2 for showing only directories and 4 for showing only visible items. Add 8 if the path includes the file name specification with wildcards. Combined pass 4+1 for visible files or 2+1 for visible directories. |
5 | Optional |
ExtensionFilter | Optional, a filter for getting only files with matching file extension. | ".txt" | Optional |
Returns JSON array or error.
List files on desktop:
MBS( "Files.ListAsJSON"; MBS("Folders.UserDesktop"); "Size¶CreationTimeStamp¶AccessTimeStamp¶ModificationTimeStamp¶Visible" )
Example result:
[
{
"Name": "Projects",
"Directory": true,
"Type": "Directory",
"Visible": true,
"Size": 64,
"CreationTimeStamp": "28.09.2020 15:52",
"AccessTimeStamp": "28.09.2020 15:51:58",
"ModificationTimeStamp": "28.09.2020 15:51:58"
}
]
List files and sort by name:
MBS( "JSON.SortWithEvaluate";
MBS( "Files.ListAsJSON";
MBS("Folders.UserDesktop");
"Size" );
"JSONGetElement ( leftJSON; \"Name\") < JSONGetElement ( rightJSON; \"Name\")" )
List files and sort by size descending:
MBS( "JSON.SortWithEvaluate";
MBS( "Files.ListAsJSON";
MBS("Folders.UserDesktop");
"Size" );
"JSONGetElement ( leftJSON; \"Size\") > JSONGetElement ( rightJSON; \"Size\")" )
Created 28th September 2020, last changed 29th September 2020
Files.List - Files.ListRecursive
Feedback: Report problem or ask question.