rsync – 仅复制整个文件

有没有办法将目录从一个文件系统复制到另一个文件系统,但是如果我们的目标文件系统上的磁盘空间不足,则删除部分文件
搜索了cp和rsync手册,但没有找到任何东西;我可以在 shell脚本中执行此操作但是如果可能的话就想避免它.
目前我这样做:
cp -r /source /dest

要么

rsync -avr /source /dest

解决方法

如果查看rsync手册,可以阅读:
--partial
     By default,rsync will delete any partially transferred file if the transfer is
     interrupted. In some circumstances it is more desirable to keep partially 
     transferred files. Using the --partial option tells rsync to keep the partial file
     which should make a subsequent transfer of the rest of the file much faster.

这意味着您无需担心部分转移.

您可以确保–partial-dir = DIR选项.然后,如果要删除部分传输的文件,则可以删除此目录下的所有文件.

相关文章

在Linux上编写运行C语言程序,经常会遇到程序崩溃、卡死等异...
git使用小结很多人可能和我一样,起初对git是一无所知的。我...
1. 操作系统环境、安装包准备 宿主机:Max OSX 10.10.5 虚拟...
因为业务系统需求,需要对web服务作nginx代理,在不断的尝试...
Linux模块机制浅析 Linux允许用户通过插入模块,实现干预内核...
一、Hadoop HA的Web页面访问 Hadoop开启HA后,会同时存在两个...