You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过rclone HTTP API配置--exclude标志完成同步任务?

解决rclone HTTP API同步时排除规则失效的问题

核心修正点

rclone HTTP API的sync接口参数格式与你尝试的AI建议存在差异,需调整以下两处:

  1. 过滤规则字段名:使用filter而非_filter或flags,无前置下划线
  2. 参数层级:checksum是sync接口的直接参数,无需嵌套在_config中

正确的curl命令

方式一:使用exclude数组直接指定排除模式

curl --location 'http://localhost:5572/sync/sync' \
--header 'Content-Type: application/json' \
--data '{
    "srcFs": "pCloud:src",
    "dstFs": "/dest",
    "checksum": true,
    "filter": {
        "exclude": ["*.txt"]
    },
    "_async": true
}'

方式二:使用rules数组传入标准rclone过滤规则

curl --location 'http://localhost:5572/sync/sync' \
--header 'Content-Type: application/json' \
--data '{
    "srcFs": "pCloud:src",
    "dstFs": "/dest",
    "checksum": true,
    "filter": {
        "rules": ["- *.txt"]
    },
    "_async": true
}'

调试建议

  • 暂时移除_async: true参数,改为同步执行,直接查看返回结果和日志,确认过滤规则是否生效
  • 使用rclone自带的rc命令行工具测试参数,更易排查问题:
    rclone rc sync/sync srcFs="pCloud:src" dstFs="/dest" checksum=true filter='{"exclude": ["*.txt"]}' --dry-run
    

内容的提问来源于stack exchange,提问作者Jean-Marc Astesana

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 08:12:12