仅复制整个文件

meh*_*urt 3 rsync copy

有没有办法将目录从一个文件系统复制到另一个文件系统,但删除部分文件,以防目标文件系统上的磁盘空间不足?
我搜索cprsync手册,但没有找到任何东西;我可以在 shell 脚本中执行此操作,但希望尽可能避免它。
目前我做的是:

cp -r /source /dest
Run Code Online (Sandbox Code Playgroud)

或者

rsync -avr /source /dest
Run Code Online (Sandbox Code Playgroud)

米。

Kha*_*led 5

如果你查看 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.
Run Code Online (Sandbox Code Playgroud)

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

您可以确定该--partial-dir=DIR选项。然后,如果您想删除部分传输的文件,可以删除该目录下的所有文件。