cy97cool
2017-11-03 00:59:22 +08:00
找到了个靠点边但不完全满足需求的:
rsync 有这个参数可以复制完成之后删除,但它不能识别正在被写入的文件,而要求使用排除*.new 这种方法避免正在被写入的文件
可以用这种方式多次调用逐步迁移进行写好的文件夹
```
--remove-source-files
This tells rsync to remove from the sending side the files (meaning non-directories) that are a
part of the transfer and have been successfully duplicated on the receiving side.
Note that you should only use this option on source files that are quiescent. If you are using
this to move files that show up in a particular directory over to another host, make sure that the
finished files get renamed into the source directory, not directly written into it, so that rsync
can ’ t possibly transfer a file that is not yet fully written. If you can ’ t first write the files
into a different directory, you should use a naming idiom that lets rsync avoid transferring files
that are not yet finished (e.g. name the file "foo.new" when it is written, rename it to "foo"
when it is done, and then use the option --exclude='*.new' for the rsync transfer).
```