> ## Documentation Index
> Fetch the complete documentation index at: https://vastai-80aa3a82-auto-cli-sdk-preview-pr-510.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# vastai copy

Copy directories between instances and/or local

## Usage

```bash theme={null}
vastai copy SRC DST
```

## Arguments

<ParamField path="src" type="string" required>
  Source location for copy operation (supports multiple formats)
</ParamField>

<ParamField path="dst" type="string" required>
  Target location for copy operation (supports multiple formats)
</ParamField>

## Options

<ParamField path="--identity" type="string">
  Location of ssh private key
</ParamField>

## Description

Copies a directory from a source location to a target location. Each of source and destination
directories can be either local or remote, subject to appropriate read and write
permissions required to carry out the action.

Supported location formats:

* \[instance\_id:]path               (legacy format, still supported)
* C.instance\_id:path              (container copy format)
* cloud\_service:path              (cloud service format)
* cloud\_service.cloud\_service\_id:path  (cloud service with ID)
* local:path                      (explicit local path)
* V.volume\_id:path                (volume copy)

You should not copy to /root or / as a destination directory, as this can mess up the permissions on your instance ssh folder, breaking future copy operations (as they use ssh authentication)
You can see more information about constraints here: [https://vast.ai/docs/gpu-instances/data-movement#constraints](https://vast.ai/docs/gpu-instances/data-movement#constraints)
Volume copy is currently only supported for copying to other volumes, instances, or cloud services, not local.

## Examples

```bash theme={null}
vastai copy 6003036:/workspace/ 6003038:/workspace/
 vastai copy C.11824:/data/test local:data/test
 vastai copy local:data/test C.11824:/data/test
 vastai copy drive:/folder/file.txt C.6003036:/workspace/
 vastai copy s3.101:/data/ C.6003036:/workspace/
 vastai copy hf.101:/my-bucket/data/ C.6003036:/workspace/
 vastai copy V.1234:/file C.5678:/workspace/
 vastai copy V.1234:/file s3.101:/workspace/

The first example copy syncs all files from the absolute directory '/workspace' on instance 6003036 to the directory '/workspace' on instance 6003038.
The second example copy syncs files from container 11824 to the local machine using structured syntax.
The third example copy syncs files from local to container 11824 using structured syntax.
The fourth example copy syncs files from Google Drive to an instance.
The fifth example copy syncs files from S3 bucket with id 101 to an instance.
The sixth example copy syncs files from a Hugging Face bucket using connection id 101 to an instance.
The seventh example copy syncs files from volume 1234 to instance 5678.
The eighth example copy syncs files from volume 1234 to S3 bucket with id 101.
```

## Global Options

The following options are available for all commands:

| Option          | Description                                           |
| --------------- | ----------------------------------------------------- |
| `--url URL`     | Server REST API URL                                   |
| `--retry N`     | Retry limit                                           |
| `--raw`         | Output machine-readable JSON                          |
| `--explain`     | Verbose explanation of API calls                      |
| `--api-key KEY` | API key (defaults to `~/.config/vastai/vast_api_key`) |
