Always use rsync for copying files, because It Is Great.
To ignore existing files:
rsync --ignore-existing --recursive /src /dst
Do read the manual and search around for many, many great examples. Especially the combination with ssh makes rsync a great tool for slow and unreliable connections on account of its --partial option. Add --verbose to see which files are being copied. Be sure to check out the plethora of options concerning preservation of permissions, users and timestamps, too.
rsync(1) absolutely shines when the source and destination are on two different computers. It is still the better tool to use when the source and destination are on the same computer.
A simple use would look like:
rsync -av /path/to/source /path/to/destination
If you're confident that any files that exist in both locations are identical, then use the --ignore-existing option:
The -z asks for compression (I wouldn't bother locally, but over a slower network link it can make a big difference) and the -P asks for --partial and --progress -- which will re-use partial file transfers if it must be restarted, and will show a handy progress bar indicator.
发布评论
评论(2)
始终使用 rsync 来复制文件,因为它很棒。
要忽略现有文件:
请阅读手册并搜索许多很多很棒的示例。尤其是与 ssh 的组合,由于其
--partial
选项,使得 rsync 成为缓慢且不可靠连接的绝佳工具。添加--verbose
以查看正在复制哪些文件。请务必检查有关保留权限、用户和时间戳的大量选项。Always use
rsync
for copying files, because It Is Great.To ignore existing files:
Do read the manual and search around for many, many great examples. Especially the combination with ssh makes
rsync
a great tool for slow and unreliable connections on account of its--partial
option. Add--verbose
to see which files are being copied. Be sure to check out the plethora of options concerning preservation of permissions, users and timestamps, too.当源和目标位于两台不同的计算机上时,
rsync(1)
绝对会大放异彩。当源和目标位于同一台计算机上时,它仍然是更好的工具。简单的用法如下:
如果您确信两个位置中存在的任何文件都是相同的,则使用
--ignore-existing
选项:只是为了完整性,当我使用 rsync(1) 在远程系统上进行备份时,我最喜欢的命令是:
-z
要求压缩(我不会打扰在本地,但通过较慢的网络链接,它可以产生很大的影响差异),并且-P
要求--partial
和--progress
——这将重用 partial 如果必须重新启动文件传输,并将显示一个方便的进度条指示器。rsync(1)
absolutely shines when the source and destination are on two different computers. It is still the better tool to use when the source and destination are on the same computer.A simple use would look like:
If you're confident that any files that exist in both locations are identical, then use the
--ignore-existing
option:Just for completeness, when I use
rsync(1)
to make a backup on a remote system, the command I most prefer is:The
-z
asks for compression (I wouldn't bother locally, but over a slower network link it can make a big difference) and the-P
asks for--partial
and--progress
-- which will re-use partial file transfers if it must be restarted, and will show a handy progress bar indicator.