---
name: yandex-disk-rclone
description: Use when working with Yandex Disk files via rclone.
version: 1.0.0
author: Hermes Agent
license: MIT
platforms: [macos, linux]
metadata:
  hermes:
    tags: [yandex, rclone, cloud, storage, sync]
prerequisites:
  commands: [rclone]
---

# Yandex Disk via rclone

Use rclone to manage files on Yandex Disk. The remote is `yandex:` (configured in `~/.config/rclone/rclone.conf`).

## Prerequisites

- rclone installed (`brew install rclone`)
- Remote `yandex:` exists — verify with `rclone listremotes`
- Yandex Disk API token stored in rclone config (do NOT read/print the config's token)

## When to Use

- User asks to work with Yandex Disk / files "в облаке" / "на яндекс диске"
- List, upload, download, delete, move, or sync files with Yandex Disk
- Existing user scripts rely on this remote: `yandex:/scripts` (bisync), `yandex:Backup/router/` (router backups)

## When NOT to Use

- Google Drive / S3 / other providers → use rclone with the appropriate remote name
- Yandex Cloud Object Storage (S3-compatible) → different remote type, different config

## Quick Reference

### Verify Setup

```bash
rclone listremotes          # must include "yandex:"
rclone about yandex:        # quota usage (may be unsupported by Yandex API)
```

### List Files

```bash
# Top level
rclone lsd yandex:                              # directories only
rclone ls yandex:                               # all files recursively, size + path
rclone lsf yandex:/scripts --files-only         # files, names only
rclone lsf yandex: --dirs-only                  # dirs, names only
rclone lsl yandex:/path --max-depth 2           # with modtime
```

### Upload / Download / Copy

```bash
# Upload a file or dir
rclone copy /local/path/file.txt yandex:/dest/
rclone copy /local/dir/ yandex:/dest/ --progress

# Download
rclone copy yandex:/dest/file.txt /local/dir/

# Move (deletes source after successful copy)
rclone move /local/file.txt yandex:/dest/ --progress
```

### Sync

```bash
# One-way: make remote exactly match local (DANGEROUS: deletes extra remote files)
rclone sync /local/dir/ yandex:/dest/ --progress

# One-way: make local exactly match remote (DANGEROUS: deletes extra local files)
rclone sync yandex:/dest/ /local/dir/

# Bidirectional (user's scripts pattern):
rclone bisync /local/dir yandex:/scripts --resync   # --resync only on first run / state loss
```

### Delete (CONFIRM FIRST)

```bash
rclone ls yandex:/path                     # show what will be affected
rclone delete yandex:/path/file.txt        # delete one file
rclone purge yandex:/path                  # delete dir + contents (no trash!)
rclone rmdir yandex:/empty-dir             # remove empty dir only
```

### Create / Misc

```bash
rclone mkdir yandex:/newdir
rclone size yandex:/path                   # total size + file count
rclone check /local/dir yandex:/dest       # verify integrity (hashes)
rclone tree yandex:/path                   # visual tree
```

## Safety Rules

1. **Always confirm before `delete`, `purge`, `sync`, or `move`** — Yandex Disk purge is permanent (no trash on API level for these ops)
2. **`rclone sync` deletes files on the target** to match the source — the direction matters. Prefer `--dry-run` first:
   ```bash
   rclone sync /local/dir/ yandex:/dest/ --dry-run
   ```
3. **Never print the rclone token** — the config holds an OAuth token; treat it as a secret
4. **Path conventions on this machine**: `yandex:/scripts` is bisync'd with `~/Documents/scripts`. Don't casually overwrite these.

## Yandex Disk Notes

- Yandex Disk API has rate limits (~90 req/min); for large bulk jobs add `--tpslimit 10 --tpslimit-burst 20` or just keep transfer counts modest (`--transfers 4`)
- `--fast-list` is NOT supported for the yandex remote
- Yandex keeps deleted files in its own trash; `rclone purge`/`delete` may still leave trash entries on the web UI side — treat as permanent anyway
- `rclone about yandex:` may fail; the API doesn't expose quota reliably

## Example Workflow

User: "залей папку reports на яндекс диск"

```bash
# 1. Check what's there
rclone lsd yandex:

# 2. Show what will be uploaded (dry run)
rclone copy /Users/user/reports/ yandex:/reports/ --dry-run

# 3. Upload
rclone copy /Users/user/reports/ yandex:/reports/ --progress

# 4. Verify
rclone lsf yandex:/reports/ --files-only | head
```
