> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cuse.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# List Directory Contents

> Lists the contents of a directory with optional filtering.



## OpenAPI

````yaml api-reference/openapi.json post /api/filesystem/list
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: http://localhost:4242/{computer_name}
    description: Local development server
    variables:
      computer_name:
        default: your-computer-name
        description: Computer name
security: []
paths:
  /api/filesystem/list:
    post:
      tags:
        - filesystem
      summary: List Directory Contents
      description: Lists the contents of a directory with optional filtering.
      operationId: listDirectory
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ListDirectoryParams'
        required: true
      responses:
        '200':
          description: Successfully listed directory contents
          content:
            application/json:
              schema:
                items:
                  $ref: '#/components/schemas/FileInfo'
                type: array
                title: Response Listdirectory
              example:
                - name: document.txt
                  path: /home/user/documents/document.txt
                  type: file
                  size: 1024
                  modified_time: '2024-03-10T12:34:56'
                  is_hidden: false
                  extension: txt
        '400':
          description: Not a directory
        '403':
          description: Permission denied
        '404':
          description: Directory not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal server error
components:
  schemas:
    ListDirectoryParams:
      properties:
        path:
          type: string
          title: Path
          description: Directory path to list
          example: /home/user/documents
        include_hidden:
          type: boolean
          title: Include Hidden
          description: Whether to include hidden files/directories
          default: false
          example: false
        pattern:
          anyOf:
            - type: string
            - type: 'null'
          title: Pattern
          description: Glob pattern to filter results
          example: '*.txt'
      type: object
      required:
        - path
      title: ListDirectoryParams
      example:
        include_hidden: false
        path: /home/user/documents
        pattern: '*.txt'
    FileInfo:
      properties:
        name:
          type: string
          title: Name
          description: File or directory name
          example: document.txt
        path:
          type: string
          title: Path
          description: Full path to the file or directory
          example: /home/user/documents/document.txt
        type:
          type: string
          title: Type
          description: 'Type of entry: ''file'' or ''directory'''
          example: file
        size:
          type: integer
          title: Size
          description: Size in bytes
          example: 1024
        modified_time:
          type: string
          format: date-time
          title: Modified Time
          description: Last modification time
          example: '2024-03-10T12:34:56'
        is_hidden:
          type: boolean
          title: Is Hidden
          description: Whether the file/directory is hidden
          example: false
        extension:
          anyOf:
            - type: string
            - type: 'null'
          title: Extension
          description: File extension if applicable
          example: txt
      type: object
      required:
        - name
        - path
        - type
        - size
        - modified_time
        - is_hidden
      title: FileInfo
      example:
        extension: txt
        is_hidden: false
        modified_time: '2024-03-10T12:34:56'
        name: document.txt
        path: /home/user/documents/document.txt
        size: 1024
        type: file
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````