---
title: "ezgh sandboxes cp"
description: "Copy a file to or from a sandbox."
---

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

# ezgh sandboxes cp

{/* Generated by ezgh-cli's internal/tools/clidocs from the ezgh command tree. Don't edit: change the command's help in ezgh-cli and regenerate. */}

```sh
ezgh sandboxes cp <source> <destination> [--mode 0644] [flags]
```

Copy one file to or from a sandbox. One side is &lt;sandbox&gt;:&lt;absolute path&gt;, the other a local path, or - for standard input (as the source) or standard output (as the destination). A suspended sandbox is resumed first.

To a sandbox, the file replaces what's at the path, as the image's user, with `--mode` (three octal digits, default 0644); a file is at most 5 GiB, and nothing is written unless all of it arrives. From a sandbox, a destination that is a directory gets the file under its own name, and the destination is only written once the whole file has arrived: a copy that ends early leaves what was there.

It copies one file. For a directory, send an archive through exec:

```text
tar -C ./src -cf - . | ezgh sandboxes exec -i <sandbox> -- tar -C /srv -xf -
```

Part of [`ezgh sandboxes`](/cli/reference/sandboxes).

## Examples

```sh
ezgh sandboxes cp ./config.json build:/srv/config.json
ezgh sandboxes cp build:/var/log/app.log .
ezgh sandboxes cp build:/srv/report.csv - | head
```

## Flags

| Flag | Type | Default | Description |
| --- | --- | --- | --- |
| `--mode` | string |  | the file's permissions in the sandbox, three octal digits (default 0644) |

This command also takes the [global flags](/cli/reference#global-flags).

Source: https://docs.ezghcloud.com/cli/reference/sandboxes-cp/index.mdx
