AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1810294
Accepted
acgbox
acgbox
Asked: 2023-09-28 01:19:33 +0800 CST2023-09-28 01:19:33 +0800 CST 2023-09-28 01:19:33 +0800 CST

我应该使用什么标志来排除与 rclone 同步的文件类型?

  • 772

我有一个要从同步中排除的文件类型列表。但是,由于其奇怪的性质,我不知道哪个标志是合适的

文件排除.txt

encryptable
Zone.identifier
.fuse_hidden*
goutputstream*
.spotlight-*
.fseventsd*
.ds_store*
~lock.*
Thumbs.db
attributes

命令:

rclone sync upload_local gdrive:upload --verbose --update --modify-window 1h --no-update-modtime --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s --stats-file-name-length 0 --exclude-from exclude.txt --log-file=rclone.log

或者您应该使用:“--exclude-regexp”或“--filter-from”

PD:但是有一些非常奇怪的事情。

用--exclude-from exclude.txt它不起作用

与--filter-from exclude.txt它不起作用(将“-”放在行的开头)

与--exclude *Zone.Identifier...它不起作用

与--exclude *.fuse_hidden...作品

与--exclude *Zone.identifier* --exclude *.fuse_hidden* --ignore-case...作品

更新:有效

最后,只要所有行都有通配符,并且正如 @petitradisgris 指出的那样,该列表--ignore-case就可以工作

rclone
  • 1 1 个回答
  • 43 Views

1 个回答

  • Voted
  1. Best Answer
    petitradisgris
    2023-09-28T04:44:45+08:002023-09-28T04:44:45+08:00

    我建议--exclude-from在这种情况下使用该标志。它允许您提供一个文本文件,其中包含要在同步期间排除的模式列表(包括像 * 这样的通配符)。

    在这种情况下,使用--exclude-regexp或--filter-from可能不合适,因为它们用于更复杂的过滤模式,并且对于您的特定示例来说可能不是必需的。

    请注意 Zone.identifier 的名称(在您的except.txt中)与您的实际文件Zone.Identifier(我是大写还是小写)。启用该--ignore-case标志后,rclone 将使用不区分大小写的匹配来匹配排除模式,因此“example.txt”、“EXAMPLE.TXT”和“ExAmple.TXt”都将在同步操作期间被排除。

    所以你的 rclone 命令看起来像:

    rclone sync upload_local gdrive:upload --verbose --update --modify-window 1h --no-update-modtime --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s --stats-file-name-length 0 --exclude-from exclude.txt --ignore-case --log-file=rclone.log 
    

    [解决方法 2]。您可以动态修改except.txt中的错误条目,而不影响任何其他条目。然后,将其传递给--exclude-from。您还希望在匹配名称时忽略大小写。(选项--ignore-case)。

    这将导致以下命令:

    rclone sync upload_local gdrive:upload --verbose --update --modify-window 1h --no-update-modtime --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s --stats-file-name-length 0 --exclude-from <(cat exclude.txt | sed 's/Zone.identifier/*Zone.Identifier*/') --ignore-case --log-file=rclone.log 
    

    [解决方法 3]。--exclude -from选项确实通过匹配确切的文件名来忽略文件。尽管如此,您可以在文件名中使用通配符来允许部分名称匹配。您的目标是处理一个既处理带通配符的部分名称又处理全名的文件,就好像它们是部分名称(带通配符)一样,而不修改磁盘上的except.txt文件。值得注意的是,您还希望在匹配名称时忽略大小写。(选项--忽略大小写)

    一种可能的解决方案是通过在行首附加通配符来主动修改except.txt ,但前提是它们尚不存在。然后,将此修改后的版本传递给--exclude-form参数。

    rclone sync upload_local gdrive:upload --verbose --update --modify-window 1h --no-update-modtime --transfers 30 --checkers 8 --contimeout 60s --timeout 300s --retries 3 --low-level-retries 10 --stats 1s --stats-file-name-length 0 --exclude-from <(cat exclude.txt | sed '/^\*/! s/^/*/g' ) --ignore-case --log-file=rclone.log 
    
    • 0

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何减少“vmmem”进程的消耗?

    • 11 个回答
  • Marko Smith

    从 Microsoft Stream 下载视频

    • 4 个回答
  • Marko Smith

    Google Chrome DevTools 无法解析 SourceMap:chrome-extension

    • 6 个回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Martin Hope
    Vickel Firefox 不再允许粘贴到 WhatsApp 网页中? 2023-08-18 05:04:35 +0800 CST
  • Martin Hope
    Saaru Lindestøkke 为什么使用 Python 的 tar 库时 tar.xz 文件比 macOS tar 小 15 倍? 2021-03-14 09:37:48 +0800 CST
  • Martin Hope
    CiaranWelsh 如何减少“vmmem”进程的消耗? 2020-06-10 02:06:58 +0800 CST
  • Martin Hope
    Jim Windows 10 搜索未加载,显示空白窗口 2020-02-06 03:28:26 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve