所以我想将一堆文件从我的 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.txt) 获得的路径被视为相对于该源的路径。看起来你在 backup.txt 文件中有绝对路径,所以你将指定
/
为源目录:您还可以指定
/Users/carlerik
为源目录,并修改 backup.txt 以仅指定其中的路径(例如,Documents/Øvelser.ptflow
而不是/Users/carlerik/Documents/Øvelser.ptflow
)。请注意,
/
文件中路径开头的 将被忽略。从手册页: