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 / 问题 / 1759727
Accepted
oligofren
oligofren
Asked: 2022-12-28 08:20:36 +0800 CST2022-12-28 08:20:36 +0800 CST 2022-12-28 08:20:36 +0800 CST

你如何使用 Rsync 的 files-from 选项?

  • 772

所以我想将一堆文件从我的 mac 同步到外部驱动器并尝试了这个:

$ rsync -vv  --files-from=backup.txt  /Volumes/Seagate\ Expansion\ Drive/2022-12-27-imac-backup/
rsync  version 2.6.9  protocol version 29
Copyright (C) 1996-2006 by Andrew Tridgell, Wayne Davison, and others.
<http://rsync.samba.org/>
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
              inplace, IPv6, 64-bit system inums, 64-bit internal inums

rsync comes with ABSOLUTELY NO WARRANTY.  This is free software, and you
are welcome to redistribute it under certain conditions.  See the GNU
General Public Licence for details.

rsync is a file transfer program capable of efficient remote update
via a fast differencing algorithm.

Usage: rsync [OPTION]... SRC [SRC]... DEST
  or   rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
  or   rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
  or   rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST
  or   rsync [OPTION]... [USER@]HOST:SRC [DEST]
  or   rsync [OPTION]... [USER@]HOST::SRC [DEST]
  or   rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
The ':' usages connect via remote shell, while '::' & 'rsync://' usages connect
to an rsync daemon, and require SRC or DEST to start with a module name.

Options
 -v, --verbose               increase verbosity
 -q, --quiet                 suppress non-error messages
....
....
(snip)
....
Use "rsync --daemon --help" to see the daemon-mode command-line options.
Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation.
See http://rsync.samba.org/ for updates, bug reports, and answers
rsync error: syntax or usage error (code 1) at /AppleInternal/Library/BuildRoots/aaefcfd1-5c95-11ed-8734-2e32217d8374/Library/Caches/com.apple.xbs/Sources/rsync/rsync/options.c(1436) [client=2.6.9]

所以它并没有说什么错了,但有些事情确实发生了。我猜是文件格式不对?但这并不那么奇特:

$ cat backup.txt 
/Users/carlerik/Downloads/Paragon-31091-PEU_MacInstallUnlock-15.10.485.dmg 
/Users/carlerik/Documents/Øvelser.ptflow
/Users/carlerik/Pictures/syncdir/2019
/Users/carlerik/Pictures/dump
/Users/carlerik/Pictures/dronebilder* 
/Users/carlerik/Pictures/profilbilde
/Users/carlerik/sohf_next-2022_10_18_11_09_03-dump.sql
/Users/carlerik/develop_k8s-2022_10_25_10_56_35-dump.sql

搜索示例并不是很有成果,因为没有人列出from 文件的内容。

$ rsync --version
rsync  version 2.6.9  protocol version 29
backup
  • 1 1 个回答
  • 17 Views

1 个回答

  • Voted
  1. Best Answer
    Gordon Davisson
    2022-12-28T14:35:34+08:002022-12-28T14:35:34+08:00

    您需要指定一个源目录;它从“来自”文件 (backup.txt) 获得的路径被视为相对于该源的路径。看起来你在 backup.txt 文件中有绝对路径,所以你将指定/为源目录:

    rsync -vv  --files-from=backup.txt / /Volumes/Seagate\ Expansion\ Drive/2022-12-27-imac-backup/
    #                                  ^ this is the source directory argument
    

    您还可以指定/Users/carlerik为源目录,并修改 backup.txt 以仅指定其中的路径(例如,Documents/Øvelser.ptflow而不是/Users/carlerik/Documents/Øvelser.ptflow)。

    请注意,/文件中路径开头的 将被忽略。从手册页:

    从 FILE 中读取的文件名都是相对于源目录的——任何前导斜杠都被删除,并且不允许“..”引用高于源目录。例如,执行以下命令:

    rsync -a --files-from=/tmp/foo /usr remote:/backup

    如果 /tmp/foo 包含字符串“bin”(甚至“/bin”),/usr/bin 目录将在远程主机上创建为 /backup/bin。

    • 1

相关问题

  • 如果源中不存在,则 rsync 从目标中删除文件夹

  • 不确定 SYSTEM 驱动器在我的第二个硬盘驱动器上做什么

  • 备份机密文件的最安全方法,可能没有云存储?

  • 无需 SD 卡或 USB 数据线即可通过 wifi 进行 Android 备份

  • 重启 Debian 服务器后目录丢失

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
    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
    v15 为什么通过电缆(同轴电缆)的千兆位/秒 Internet 连接不能像光纤一样提供对称速度? 2020-01-25 08:53:31 +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