# cp

## Usage

```bash
bdy sandbox cp [options] <source> <destination>
```

## Arguments

| **Argument** | **Description** |
| :--- | :--- |
| `source` | Local path or sandbox path (sandbox-id:/path) (required) |
| `destination` | Local path or sandbox path (sandbox-id:/path) (required) |

## Options

| **Option** | **Description** |
| :--- | :--- |
| `-w, --workspace <domain>` | Workspace URL handle. Can be set via variable: BUDDY_WORKSPACE |
| `-p, --project <name>` | Project name. Can be set via variable: BUDDY_PROJECT |
| `-m, --merge` | Merge contents of the destination directory with sandbox content |
| `-r, --replace` | Replace contents of the destination directory with sandbox content |
| `-h, --help` | display help for command |

## Examples

### Copy file from sandbox to local directory with a new name

```bash
bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/name
```

### If local path file already exists you must replace it

```bash
bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/name --replace
```

### Copy file from sandbox INTO local directory

```bash
bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/
```

### If local directory already exists you must merge it or replace it

```bash
bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/ --merge
bdy sb cp sandbox-identifier:/path/to/file /path/to/dir/ --replace
```

### Copy directory from sandbox to local directory with a new name

```bash
bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir
```

### If local directory already exists you must replace it

```bash
bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir --replace
```

### Copy directory from sandbox INTO local directory

```bash
bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir/
```

### If local directory already exists you must merge it or replace it

```bash
bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir/ --merge
bdy sb cp sandbox-identifier:/path/to/dir /path/to/dir/ --replace
```

### Copy local file to sandbox with a new name

```bash
bdy sb cp /path/to/file sandbox-identifier:/path/to/dir/name
```

### Copy local file into sandbox directory

```bash
bdy sb cp /path/to/file sandbox-identifier:/path/to/dir/
```

### Copy contents of local directory to sandbox directory

```bash
bdy sb cp /path/to/dir sandbox-identifier:/path/to/dir
```

### Copy local directory into sandbox directory

```bash
bdy sb cp /path/to/dir sandbox-identifier:/path/to/dir/
```


---
Original source: https://buddy.works/docs/cli/sandbox/cp