# CLI Sync

> Sync hashes locally and transfers only what changed, so large trees stay fast. Flags cover dry runs, deletes, concurrency, ignores and watch mode.

The `sync` command keeps a local directory in sync with a remote Hyperfile filesystem.

## Basic Usage

```bash
hyperfile sync ./my-files --fs <filesystem-uid>
```

## How It Works

1. **Scan** — Hashes all local files
2. **Diff** — Compares local hashes with the remote file tree
3. **Upload** — Sends new or changed files
4. **Update** — Updates the remote tree to match local

Only changed files are transferred, making sync fast even for large directories.

## Options

| Flag | Description |
|---|---|
| `--fs <uid>` | Target filesystem UID |
| `--path <remote-path>` | Sync to a specific remote folder |
| `--dry-run` | Show what would change without uploading |
| `--delete` | Remove remote files not present locally |
| `--concurrency <n>` | Number of parallel uploads (default: 8) |

## Ignore Patterns

Create a `.hyperfileignore` file (same syntax as `.gitignore`) to exclude files from sync.

```
node_modules/
.git/
*.log
.DS_Store
```

## Watching for Changes

Use `--watch` to continuously sync as files change:

```bash
hyperfile sync ./my-files --fs <uid> --watch
```

---

Canonical HTML version: https://hyperfile.io/docs/cli/sync/
