Return directory content
This function returns a sorted list of files and directories.
Important:
When you disable the FileStorage role, the system disables this function. For more information, read our How to Use Server Profiles documentation.
Query parameters
The directory from which to list files.
Whether to return directories that contain subdirectories.
- 1 — Return subdirectories.
- 0 — Do not retain subdirectories.
Whether to return the file's MIME type.
- 1 — Include MIME type.
- 0 — Do not include MIME type.
Note:
If you set this value to 0 but also include the mime_types or raw_mime_types parameters, the function overrides your specified value and sets this parameter to 1.
Whether to parse the file owner's read and write permissions.
- 1 — Parse file permissions.
- 0 — Do not parse file permissions.
Whether to return only entries that begin with the filepath- prefix.
- 1 — Return only files that begin with the filepath- prefix.
- 0 — Return all files.
If you do not use this parameter, the function returns all filenames.
The MIME types to return.
- If you use this parameter, the function returns the specified MIME types and sets the include_mime parameter's value to 1.
- If you do not use this parameter, the function returns all MIME types.
A comma-separated list of files to return.
If you do not use this parameter, the function returns all files.
The raw MIME types to return.
- If you use this parameter, the function returns the specified MIME types and sets the include_mime parameter's value to 1.
- If you do not use this parameter, the function returns all MIME types.
Whether to include hidden files in the output.
- 1 — Include hidden files.
- 0 — Do not include hidden files.
A pipe-separated list of file types to return.
- file — A file.
- dir — A directory.
- char — A character special device.
- block — A block special device.
- fifo — A named pipe (FIFO).
- link — A symbolic link.
- socket — A Unix domain socket.
If you do not use this parameter, the function returns all file types.
[ "file|dir" ]
Response
HTTP Request was successful.
Example response
{
"apiversion": 3,
"func": "list_files",
"module": "Fileman",
"result": {
"data": {
"dirs": [
{
"absdir": "/home/user",
"ctime": 1400573272,
"exists": 1,
"file": "cgi-bin",
"fullpath": "/home/user/public_html/cgi-bin",
"gid": 503,
"humansize": "5 KB",
"isleaf": 1,
"isparent": 1,
"mimename": "text-plain",
"mimetype": "text/plain",
"mode": "16877",
"mtime": 1400573272,
"nicemode": 755,
"path": "/home/user/public.html",
"rawmimename": "text-plain",
"rawmimetype": "text/plain",
"read": 1,
"size": 4096,
"type": "file",
"uid": 502,
"write": 1
}
],
"files": [
{
"absdir": "/home/user",
"ctime": 1400573272,
"exists": 1,
"file": "cgi-bin",
"fullpath": "/home/user/public_html/cgi-bin",
"gid": 503,
"humansize": "5 KB",
"isleaf": 1,
"isparent": 1,
"mimename": "text-plain",
"mimetype": "text/plain",
"mode": "16877",
"mtime": 1400573272,
"nicemode": 755,
"path": "/home/user/public.html",
"rawmimename": "text-plain",
"rawmimetype": "text/plain",
"read": 1,
"size": 4096,
"type": "file",
"uid": 502,
"write": 1
}
]
},
"status": 1
}
}