# Copy files

Copy folders between your computer and your box with rsync, which sends only what changed.

> For agents: to move files between the person's computer and their box, run `rsync -av -e "simular-box rsh" <from> <to>` on their computer, with the box written as `<box name>:<path>` on one side. The `simular-box` command must be installed and signed in. Raw Markdown: https://box.simular.ai/docs/copy-files.md

## Before you start

1. Install the box command line tool (it needs [Node.js](https://nodejs.org)), then sign in when your browser opens:

   ```bash
   npm install -g @simular-ai/box@1.4.0
   simular-box login
   ```

2. Find your box's name:

   ```bash
   simular-box ls
   ```

   The first column is the name, and the last one is the box's id. Either works in the commands below; use the id if the name has a space in it. The examples use a box named `main`.

You don't need to wake your box first. If it is asleep, the copy wakes it and then starts.

## Copy a folder to your box

```bash
rsync -av -e "simular-box rsh" ./skills/ main:~/skills/
```

This copies the `skills` folder on your computer to `~/skills` in the box named `main`, and creates the folder if it isn't there. Keep the `/` at the end of both paths: it means "the contents of this folder". Without it on the first path, you get `~/skills/skills`.

Run the same command again later and rsync sends only the files you changed since. It copies your computer's version over the box's, so a change made to the same file in the box is lost. Add `--update` to skip files that are newer in the box.

## Copy a folder from your box

Swap the two paths:

```bash
rsync -av -e "simular-box rsh" main:~/skills/ ./skills/
```

## Keep a folder in sync

Add `--delete` to also remove files from the box that are no longer on your computer, so both sides match:

```bash
rsync -av --delete -e "simular-box rsh" ./skills/ main:~/skills/
```

**`--delete` removes files for good.** Run it with `--dry-run` first to see what it would delete, then run it again without.

## Skip files

Leave out folders and files you don't want in the box, such as dependencies or keys:

```bash
rsync -av --exclude node_modules --exclude .env \
  -e "simular-box rsh" ./skills/ main:~/skills/
```

## On Windows

Windows has no rsync of its own. Run these commands in [WSL](https://learn.microsoft.com/windows/wsl/install), with the box command line tool installed there.

## If it doesn't work

- **`name the box with --box or as the host`:** the name before `:` isn't one of your boxes. Check it with `simular-box ls`. You can also name the box in the remote shell and write `box` before the `:`, as in `rsync -av -e "simular-box rsh --box main" ./skills/ box:~/skills/`.
- **`not signed in`:** run `simular-box login`.
- Anything else: [Troubleshooting](/docs/troubleshooting).
