---
title: "Return directory content"
method: GET
path: "/Fileman/list_files"
tags: ["Fileman", "Manage Files"]
---

# Return directory content

`GET /Fileman/list_files`

This function returns a sorted list of files and directories.

**Important:**

When you disable the [FileStorage role](https://go.cpanel.net/howtouseserverprofiles#roles), the system **disables** this function. For more information, read our How to Use Server Profiles documentation.

## Query parameters

- `dir` string, required
- `check_for_leaf_directories` 0 | 1
- `include_mime` 0 | 1
- `include_permissions` 0 | 1
- `limit_to_list` 0 | 1
- `mime_types` string
- `only_these_files` string
- `raw_mime_types` string
- `show_hidden` 0 | 1
- `types` string[]

## Response `200`

HTTP Request was successful.

- object
  - `apiversion` integer — The version of the API.
  - `func` string — The name of the method called.
  - `module` string — The name of the module called.
  - `result` object
    - `data` object
      - `dirs` object[] — An array of objects containing information about each directory.
        - `absdir` string, path — The file path to the user's home directory.
        - `ctime` integer — The directory's creation date.
        - `exists` 0 | 1 — Whether the directory exists in the directory. * `1` — Exists. * `0` — Does **not** exist.
        - `file` string — The directory name.
        - `fullpath` string, path — The directory's full directory path.
        - `gid` integer — The directory owner's system group ID.
        - `humansize` string — The formatted size of the directory. The function returns the size with one of the following symbols: * `KB` — Kilobytes. * `MB` — Megabytes. * `GB` — Gigabytes.
        - `isleaf` 0 | 1 — Whether the directory contains subdirectories. * `1` — Contains subdirectories. * `0` — Does **not** contain subdirectories.
        - `isparent` 0 | 1 — Whether the directory is a parent record. * `1` — A parent record. * `0` — **Not** a parent record.
        - `mimename` string — The MIME type's name.
        - `mimetype` string — The directory's MIME's type.
        - `mode` string, unix-file-permission — The directory's textual permissions in [Unix format](http://en.wikipedia.org/wiki/File_system_permissions#Notation_of_traditional_Unix_permissions).
        - `mtime` integer — The directory's last modification time.
        - `nicemode` integer — The directory's numerical permissions.
        - `path` string, path — The path to the directory.
        - `rawmimename` string — The directory's raw MIME type's name.
        - `rawmimetype` string — The directory's raw MIME type.
        - `read` 0 | 1 — Whether the directory is readable. * `1` — Readable. * `0` — **Not** readable. **Note:** The function only returns this value if the `include_permissions` value is `1`.
        - `size` integer — The directory's size, in bytes.
        - `type` 'file' | 'dir' | 'char' | 'block' | 'fifo' | 'link' | 'socket' — The item's type. * `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.
        - `uid` integer — The directory owner's system user ID.
        - `write` 0 | 1 — Whether the directory is writable. * `1` — Writable. * `0` — **Not** writable. **Note:** The function only returns this value if the `include_permissions` value is `1`.
      - `files` object[] — An array of objects containing information about each file.
        - `absdir` string, path — The file path to the user's home directory.
        - `ctime` integer — The file's creation time.
        - `exists` 0 | 1 — Whether the file exists in the directory. * `1` — Exists. * `0` — Does **not** exist.
        - `file` string — The filename.
        - `fullpath` string, path — The file's full file path.
        - `gid` integer — The file owner's system group ID.
        - `humansize` string — The formatted size of the file. The function returns the size with one of the following symbols: * `KB` — Kilobytes. * `MB` — Megabytes. * `GB` — Gigabytes.
        - `isleaf` 0 | 1 — Whether the directory contains subdirectories. * `1` — Contains subdirectories. * `0` — Does **not** contain subdirectories.
        - `isparent` 0 | 1 — Whether the file is a parent record. * `1` — A parent record. * `0` — **Not** a parent record.
        - `mimename` string — The file's MIME type name.
        - `mimetype` string — The file's MIME type.
        - `mode` string, unix-file-permission — The file's textual permissions.
        - `mtime` integer — The file's last modification time.
        - `nicemode` integer — The file's numerical permissions.
        - `path` string, path — The absolute path to the file.
        - `rawmimename` string — The file's raw MIME type's name.
        - `rawmimetype` string — The file's raw MIME type.
        - `read` 0 | 1 — Whether the file is readable. * `1` — Readable. * `0` — **Not** readable. **Note:** The function only returns this value if the `include_permissions` value is `1`.
        - `size` integer — The file's size, in bytes.
        - `type` 'file' | 'dir' | 'char' | 'block' | 'fifo' | 'link' | 'socket' — The item's type. * `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.
        - `uid` integer — The file owner's system user ID.
        - `write` 0 | 1 — Whether the file is writable. * `1` — Writable. * `0` — **Not** writable. **Note:** The function only returns this value if the `include_permissions` value is `1`.
    - `errors` string[], nullable — List of errors if the API failed.
    - `messages` string[], nullable — List of messages generated by the API.
    - `metadata` object
    - `status` 0 | 1 — * `1` — Success * `0` — Failed: Check the errors field for more details.
    - `warnings` string[], nullable — List of warnings generated by the API. Warnings describe non-critical failures or other problematic conditions noted while running a API.

---

[API](https://skmtc.net/cpanel/apis/cpanel-uapi.md) · [All operations](https://skmtc.net/cpanel/apis/cpanel-uapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cpanel/cpanel-uapi/revisions/632e2f8e6d04/schema)
