rclone

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

rclone File Transfer Skill

rclone 文件传输技能

Setup Check (Always Run First)

前置检查(务必先执行)

Before any rclone operation, verify installation and configuration:
bash
undefined
在进行任何rclone操作之前,请验证安装和配置情况:
bash
undefined

Check if rclone is installed

检查rclone是否已安装

command -v rclone >/dev/null 2>&1 && echo "rclone installed: $(rclone version | head -1)" || echo "NOT INSTALLED"
command -v rclone >/dev/null 2>&1 && echo "rclone installed: $(rclone version | head -1)" || echo "NOT INSTALLED"

List configured remotes

列出已配置的远程存储

rclone listremotes 2>/dev/null || echo "NO REMOTES CONFIGURED"
undefined
rclone listremotes 2>/dev/null || echo "NO REMOTES CONFIGURED"
undefined

If rclone is NOT installed

若未安装rclone

Guide the user to install:
bash
undefined
引导用户进行安装:
bash
undefined

macOS

macOS系统

brew install rclone
brew install rclone

Linux (script install)

Linux系统(脚本安装)

Or via package manager

或通过包管理器安装

sudo apt install rclone # Debian/Ubuntu sudo dnf install rclone # Fedora
undefined
sudo apt install rclone # Debian/Ubuntu系统 sudo dnf install rclone # Fedora系统
undefined

If NO remotes are configured

若未配置远程存储

Walk the user through interactive configuration:
bash
rclone config
Common provider setup quick reference:
ProviderTypeKey Settings
AWS S3
s3
access_key_id, secret_access_key, region
Cloudflare R2
s3
access_key_id, secret_access_key, endpoint (account_id.r2.cloudflarestorage.com)
Backblaze B2
b2
account (keyID), key (applicationKey)
DigitalOcean Spaces
s3
access_key_id, secret_access_key, endpoint (region.digitaloceanspaces.com)
Google Drive
drive
OAuth flow (opens browser)
Dropbox
dropbox
OAuth flow (opens browser)
Example: Configure Cloudflare R2
bash
rclone config create r2 s3 \
  provider=Cloudflare \
  access_key_id=YOUR_ACCESS_KEY \
  secret_access_key=YOUR_SECRET_KEY \
  endpoint=ACCOUNT_ID.r2.cloudflarestorage.com \
  acl=private
Example: Configure AWS S3
bash
rclone config create aws s3 \
  provider=AWS \
  access_key_id=YOUR_ACCESS_KEY \
  secret_access_key=YOUR_SECRET_KEY \
  region=us-east-1
引导用户完成交互式配置:
bash
rclone config
常见提供商配置快速参考:
提供商类型关键设置
AWS S3
s3
access_key_id, secret_access_key, region
Cloudflare R2
s3
access_key_id, secret_access_key, endpoint (account_id.r2.cloudflarestorage.com)
Backblaze B2
b2
account (keyID), key (applicationKey)
DigitalOcean Spaces
s3
access_key_id, secret_access_key, endpoint (region.digitaloceanspaces.com)
Google Drive
drive
OAuth流程(打开浏览器)
Dropbox
dropbox
OAuth流程(打开浏览器)
示例:配置Cloudflare R2
bash
rclone config create r2 s3 \
  provider=Cloudflare \
  access_key_id=YOUR_ACCESS_KEY \
  secret_access_key=YOUR_SECRET_KEY \
  endpoint=ACCOUNT_ID.r2.cloudflarestorage.com \
  acl=private
示例:配置AWS S3
bash
rclone config create aws s3 \
  provider=AWS \
  access_key_id=YOUR_ACCESS_KEY \
  secret_access_key=YOUR_SECRET_KEY \
  region=us-east-1

Common Operations

常用操作

Upload single file

上传单个文件

bash
rclone copy /path/to/file.mp4 remote:bucket/path/ --progress
bash
rclone copy /path/to/file.mp4 remote:bucket/path/ --progress

Upload directory

上传目录

bash
rclone copy /path/to/folder remote:bucket/folder/ --progress
bash
rclone copy /path/to/folder remote:bucket/folder/ --progress

Sync directory (mirror, deletes removed files)

同步目录(镜像模式,会删除远程已移除的文件)

bash
rclone sync /local/path remote:bucket/path/ --progress
bash
rclone sync /local/path remote:bucket/path/ --progress

List remote contents

列出远程存储内容

bash
rclone ls remote:bucket/
rclone lsd remote:bucket/  # directories only
bash
rclone ls remote:bucket/
rclone lsd remote:bucket/  # 仅列出目录

Check what would be transferred (dry run)

预演传输内容(试运行)

bash
rclone copy /path remote:bucket/ --dry-run
bash
rclone copy /path remote:bucket/ --dry-run

Useful Flags

实用参数

FlagPurpose
--progress
Show transfer progress
--dry-run
Preview without transferring
-v
Verbose output
--transfers=N
Parallel transfers (default 4)
--bwlimit=RATE
Bandwidth limit (e.g.,
10M
)
--checksum
Compare by checksum, not size/time
--exclude="*.tmp"
Exclude patterns
--include="*.mp4"
Include only matching
--min-size=SIZE
Skip files smaller than SIZE
--max-size=SIZE
Skip files larger than SIZE
参数用途
--progress
显示传输进度
--dry-run
预演操作,不实际传输文件
-v
详细输出日志
--transfers=N
并行传输数量(默认4个)
--bwlimit=RATE
带宽限制(例如:
10M
--checksum
通过校验和对比文件,而非大小/修改时间
--exclude="*.tmp"
排除指定模式的文件
--include="*.mp4"
仅包含匹配模式的文件
--min-size=SIZE
跳过小于指定大小的文件
--max-size=SIZE
跳过大于指定大小的文件

Large File Uploads

大文件上传

For videos and large files, use chunked uploads:
bash
undefined
对于视频和大文件,使用分块上传:
bash
undefined

S3 multipart upload (automatic for >200MB)

S3分段上传(文件大于200MB时自动触发)

rclone copy large_video.mp4 remote:bucket/ --s3-chunk-size=64M --progress
rclone copy large_video.mp4 remote:bucket/ --s3-chunk-size=64M --progress

Resume interrupted transfers

恢复中断的传输

rclone copy /path remote:bucket/ --progress --retries=5
undefined
rclone copy /path remote:bucket/ --progress --retries=5
undefined

Verify Upload

验证上传结果

bash
undefined
bash
undefined

Check file exists and matches

检查文件是否存在且内容匹配

rclone check /local/file remote:bucket/file
rclone check /local/file remote:bucket/file

Get file info

获取文件信息

rclone lsl remote:bucket/path/to/file
undefined
rclone lsl remote:bucket/path/to/file
undefined

Troubleshooting

故障排查

bash
undefined
bash
undefined

Test connection

测试连接

rclone lsd remote:
rclone lsd remote:

Debug connection issues

调试连接问题

rclone lsd remote: -vv
rclone lsd remote: -vv

Check config

查看配置信息

rclone config show remote
undefined
rclone config show remote
undefined