modal volume

Read and edit modal.Volume volumes.

Note: users of modal.NetworkFileSystem should use the modal nfs command instead.

Usage:

modal volume [OPTIONS] COMMAND [ARGS]...

Options:

  • --help: Show this message and exit.

Commands:

  • cp: Copy source file to destination file or multiple source files to destination directory.
  • create: Create a named, persistent modal.Volume.
  • delete: Delete a named, persistent modal.Volume.
  • get: Download files from a modal.Volume.
  • list: List the details of all modal.Volume volumes in an environment.
  • ls: List files and directories in a modal.Volume volume.
  • put: Upload a file or directory to a volume.
  • rm: Delete a file or directory from a volume.

Copy source file to destination file or multiple source files to destination directory.

Usage:

modal volume cp [OPTIONS] VOLUME_NAME PATHS...

Arguments:

  • VOLUME_NAME: [required]
  • PATHS...: [required]

Options:

  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Create a named, persistent modal.Volume.

Usage:

modal volume create [OPTIONS] NAME

Arguments:

  • NAME: [required]

Options:

  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Delete a named, persistent modal.Volume.

Usage:

modal volume delete [OPTIONS] VOLUME_NAME

Arguments:

  • VOLUME_NAME: Name of the modal.Volume to be deleted. Case sensitive [required]

Options:

  • --confirm / --no-confirm: Set this flag to delete without prompting for confirmation [default: no-confirm]
  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Download files from a modal.Volume.

Specifying a glob pattern (using any * or ** patterns) as the remote_path will download all matching files, preserving the source directory structure for the matched files.

Example

modal volume get <volume-name> logs/april-12-1.txt .
modal volume get <volume-name> "**" dump_volume

Use ”-” (a hyphen) as LOCAL_DESTINATION to write contents of file to stdout (only for non-glob paths).

Usage:

modal volume get [OPTIONS] VOLUME_NAME REMOTE_PATH [LOCAL_DESTINATION]

Arguments:

  • VOLUME_NAME: [required]
  • REMOTE_PATH: [required]
  • [LOCAL_DESTINATION]: [default: .]

Options:

  • --force / --no-force: [default: no-force]
  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

List the details of all modal.Volume volumes in an environment.

Usage:

modal volume list [OPTIONS]

Options:

  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --json / --no-json: [default: no-json]
  • --help: Show this message and exit.

List files and directories in a modal.Volume volume.

Usage:

modal volume ls [OPTIONS] VOLUME_NAME [PATH]

Arguments:

  • VOLUME_NAME: [required]
  • [PATH]: [default: /]

Options:

  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Upload a file or directory to a volume.

Remote parent directories will be created as needed.

Ending the REMOTE_PATH with a forward slash (/), it’s assumed to be a directory and the file will be uploaded with its current name under that directory.

Usage:

modal volume put [OPTIONS] VOLUME_NAME LOCAL_PATH [REMOTE_PATH]

Arguments:

  • VOLUME_NAME: [required]
  • LOCAL_PATH: [required]
  • [REMOTE_PATH]: [default: /]

Options:

  • -f, --force: Overwrite existing files.
  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.

Delete a file or directory from a volume.

Usage:

modal volume rm [OPTIONS] VOLUME_NAME REMOTE_PATH

Arguments:

  • VOLUME_NAME: [required]
  • REMOTE_PATH: [required]

Options:

  • -r, --recursive: Delete directory recursively
  • --env TEXT: Environment to interact with.

If not specified, Modal will use the default environment of your current profile, or the MODAL_ENVIRONMENT variable. Otherwise, raises an error if the workspace has multiple environments.

  • --help: Show this message and exit.