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

# cp

> cpln cp — Copy files and directories to and from running workloads.

Copy files and directories to and from workloads.

Refer to the [cpln cp guide](/guides/cli/cpln-cp) for additional details.

**Usage**

```none theme={null}
cpln cp <file-spec-src> <file-spec-dest> [OPTIONS]
```

<Accordion title="Reference">
  ```text theme={null}
  Positionals:
    file-spec-src   A path to the source file or directory to copy from. Use a local path or workloadName:path for paths within a workload  [string] [required]
    file-spec-dest  A path to the destination file or directory to copy to. Use a local path or workloadName:path for paths within a workload  [string] [required]

  Command options:
    --location       A global virtual cloud location  [string]
    --container, -c  The name of the workload container
    --replica        The name of the workload deployment replica
    --no-preserve    The copied file/directory's ownership and permissions will not be preserved in the container  [boolean] [default: false]

  Context options:
    --profile  Override the profile. The default profile can be set using the `cpln profile set-default` command or by setting the CPLN_PROFILE environment variable
    --org      Override the organization. The default organization can be set in your profile by using the `cpln profile update` command
    --gvc      Override the global virtual cloud. The default global virtual cloud can be set in your profile by using the `cpln profile update` command

  Format options:
    --output, -o  Set the output format  [choices: "text", "json", "yaml", "json-slim", "yaml-slim", "tf", "crd", "names"]
    --color       Colorize the output  [boolean] [default: true]
    --ts          Timestamp format if the output format is text (e.g., --output=text)  [choices: "iso", "local", "age"]
    --max         Maximum number of records to show. A value less than 1 will return all records.  [number] [default: 50]

  Request options:
    --token         Override the authorization token
    --endpoint      Override the API URL
    --insecure, -k  Ignore TLS errors  [boolean]

  Debug options:
    --verbose, -v  Enable verbose output to stderr  [boolean] [default: false]
    --debug, -d    Show all HTTP communications  [boolean] [default: false]

  Options:
    --help     Show help  [boolean]
    --version  Show version number  [boolean]
  ```

  [Common Options Reference](/cli-reference/using-cli/common-options)
</Accordion>

<Accordion title="Example">
  * Copy file from local machine to workload

  <CodeGroup>
    ```bash Command theme={null}
    cpln cp ./demo-file.txt demo-workload:path/within/workload/ --org demo-cpln-organization --gvc demo-gvc
    ```

    ```text Output theme={null}
    If the copy was successful, a new command prompt will be shown.
    ```
  </CodeGroup>

  * Copy directory from local machine to workload

  <CodeGroup>
    ```bash Command theme={null}
    cpln cp ./demo-directory demo-workload:path/within/workload/ --org demo-cpln-organization --gvc demo-gvc
    ```

    ```text Output theme={null}
    If the copy was successful, a new command prompt will be shown.
    ```
  </CodeGroup>

  * Copy file from workload to local machine

  <CodeGroup>
    ```bash Command theme={null}
    cpln cp demo-workload:path/within/workload/demo-file.txt ./demo-file.txt --org demo-cpln-organization --gvc demo-gvc
    ```

    ```text Output theme={null}
    If the copy was successful, a new command prompt will be shown.
    ```
  </CodeGroup>

  * Copy directory from workload to local machine

  <CodeGroup>
    ```bash Command theme={null}
    cpln cp demo-workload:path/within/workload/demo-directory ./demo-directory --org demo-cpln-organization --gvc demo-gvc
    ```

    ```text Output theme={null}
    If the copy was successful, a new command prompt will be shown.
    ```
  </CodeGroup>
</Accordion>

***
