# Return directory content This function returns a sorted list of files and directories. When you disable the FileStorage role, the system this function. For more information, read our How to Use Server Profiles documentation. Endpoint: GET /Fileman/list_files Version: 11.134.0.5 Security: BasicAuth ## Query parameters: - `dir` (string, required) The directory from which to list files. Example: "public_html" - `check_for_leaf_directories` (integer) Whether to return directories that contain subdirectories. * — Return subdirectories. * — Do retain subdirectories. Enum: 0, 1 - `include_mime` (integer) Whether to return the file's MIME type. * — Include MIME type. * — Do include MIME type. If you set this value to but also include the or parameters, the function your specified value and sets this parameter to . Enum: 0, 1 - `include_permissions` (integer) Whether to parse the file owner's read and write permissions. * — Parse file permissions. * — Do parse file permissions. Enum: 0, 1 - `limit_to_list` (integer) Whether to return only entries that begin with the prefix. * — Return only files that begin with the prefix. * — Return files. If you do not use this parameter, the function returns all filenames. Enum: 0, 1 - `mime_types` (string) The MIME types to return. * If you use this parameter, the function returns the specified MIME types and sets the parameter's value to . * If you do use this parameter, the function returns all MIME types. Example: "text-plain" - `only_these_files` (string) A comma-separated list of files to return. If you do not use this parameter, the function returns all files. Example: "cpbackup-exclude.conf" - `raw_mime_types` (string) The raw MIME types to return. * If you use this parameter, the function returns the specified MIME types and sets the parameter's value to . * If you do use this parameter, the function returns all MIME types. Example: "text/plain" - `show_hidden` (integer) Whether to include hidden files in the output. * — Include hidden files. * — Do include hidden files. Enum: 0, 1 - `types` (array) A pipe-separated list of file types to return. * — A file. * — A directory. * — A character special device. * — A block special device. * — A named pipe (FIFO). * — A symbolic link. * — A Unix domain socket. If you do not use this parameter, the function returns all file types. Example: ["file|dir"] ## Response 200 fields (application/json): - `apiversion` (integer) The version of the API. Example: 3 - `func` (string) The name of the method called. Example: "list_files" - `module` (string) The name of the module called. Example: "Fileman" - `result` (object) - `result.data` (object) - `result.data.dirs` (array) An array of objects containing information about each directory. - `result.data.dirs.absdir` (string) The file path to the user's home directory. Example: "/home/user" - `result.data.dirs.ctime` (integer) The directory's creation date. Example: 1400573272 - `result.data.dirs.exists` (integer) Whether the directory exists in the directory. * — Exists. * — Does exist. Enum: 0, 1 - `result.data.dirs.file` (string) The directory name. Example: "cgi-bin" - `result.data.dirs.fullpath` (string) The directory's full directory path. Example: "/home/user/public_html/cgi-bin" - `result.data.dirs.gid` (integer) The directory owner's system group ID. Example: 503 - `result.data.dirs.humansize` (string) The formatted size of the directory. The function returns the size with one of the following symbols: * — Kilobytes. * — Megabytes. * — Gigabytes. Example: "5 KB" - `result.data.dirs.isleaf` (integer) Whether the directory contains subdirectories. * — Contains subdirectories. * — Does contain subdirectories. Enum: 0, 1 - `result.data.dirs.isparent` (integer) Whether the directory is a parent record. * — A parent record. * — a parent record. Enum: 0, 1 - `result.data.dirs.mimename` (string) The MIME type's name. Example: "text-plain" - `result.data.dirs.mimetype` (string) The directory's MIME's type. Example: "text/plain" - `result.data.dirs.mode` (string) The directory's textual permissions in [Unix format](http://en.wikipedia.org/wiki/File_system_permissions#Notation_of_traditional_Unix_permissions). Example: "16877" - `result.data.dirs.mtime` (integer) The directory's last modification time. Example: 1400573272 - `result.data.dirs.nicemode` (integer) The directory's numerical permissions. Example: 755 - `result.data.dirs.path` (string) The path to the directory. Example: "/home/user/public.html" - `result.data.dirs.rawmimename` (string) The directory's raw MIME type's name. Example: "text-plain" - `result.data.dirs.rawmimetype` (string) The directory's raw MIME type. Example: "text/plain" - `result.data.dirs.read` (integer) Whether the directory is readable. * — Readable. * — readable. The function only returns this value if the value is . Enum: 0, 1 - `result.data.dirs.size` (integer) The directory's size, in bytes. Example: 4096 - `result.data.dirs.type` (string) The item's type. * — A file. * — A directory. * — A character special device. * — A block special device. * - A named pipe (FIFO). * — A symbolic link. * — A Unix domain socket. Enum: "file", "dir", "char", "block", "fifo", "link", "socket" - `result.data.dirs.uid` (integer) The directory owner's system user ID. Example: 502 - `result.data.dirs.write` (integer) Whether the directory is writable. * — Writable. * — writable. The function only returns this value if the value is . Enum: 0, 1 - `result.data.files` (array) An array of objects containing information about each file. - `result.data.files.ctime` (integer) The file's creation time. Example: 1400573272 - `result.data.files.exists` (integer) Whether the file exists in the directory. * — Exists. * — Does exist. Enum: 0, 1 - `result.data.files.file` (string) The filename. Example: "cgi-bin" - `result.data.files.fullpath` (string) The file's full file path. Example: "/home/user/public_html/cgi-bin" - `result.data.files.gid` (integer) The file owner's system group ID. Example: 503 - `result.data.files.humansize` (string) The formatted size of the file. The function returns the size with one of the following symbols: * — Kilobytes. * — Megabytes. * — Gigabytes. Example: "5 KB" - `result.data.files.isparent` (integer) Whether the file is a parent record. * — A parent record. * — a parent record. Enum: 0, 1 - `result.data.files.mimename` (string) The file's MIME type name. Example: "text-plain" - `result.data.files.mimetype` (string) The file's MIME type. Example: "text/plain" - `result.data.files.mode` (string) The file's textual permissions. Example: "16877" - `result.data.files.mtime` (integer) The file's last modification time. Example: 1400573272 - `result.data.files.nicemode` (integer) The file's numerical permissions. Example: 755 - `result.data.files.path` (string) The absolute path to the file. Example: "/home/user/public.html" - `result.data.files.rawmimename` (string) The file's raw MIME type's name. Example: "text-plain" - `result.data.files.rawmimetype` (string) The file's raw MIME type. Example: "text/plain" - `result.data.files.read` (integer) Whether the file is readable. * — Readable. * — readable. The function only returns this value if the value is . Enum: 0, 1 - `result.data.files.size` (integer) The file's size, in bytes. Example: 4096 - `result.data.files.uid` (integer) The file owner's system user ID. Example: 502 - `result.data.files.write` (integer) Whether the file is writable. * — Writable. * — writable. The function only returns this value if the value is . Enum: 0, 1 - `result.errors` (array,null) List of errors if the API failed. - `result.messages` (array,null) List of messages generated by the API. - `result.metadata` (object) - `result.status` (integer) * — Success * — Failed: Check the errors field for more details. Enum: 0, 1 - `result.warnings` (array,null) List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.