其他的可以源码安装,到下面的网站下载
http://rsync.samba.org2. rsync提供了一些跟删除有关的参数
rsync --help | grep delete
--del an alias for --delete-during
--delete delete extraneous files from destination dirs
--delete-before receiver deletes before transfer, not during
--delete-during receiver deletes during transfer (default)
--delete-delay find deletions during, delete after
--delete-after receiver deletes after transfer, not during
--delete-excluded also delete excluded files from destination dirs
--ignore-errors delete even if there are I/O errors
--max-delete=NUM don't delete more than NUM files
其中--delete-before接收者在传输之前进行删除操作
3. 示例
清空目录或文件,如下:
1、先建立一个空目录
代码如下:
mkdir /data/blank
2、用rsync删除目标目录
代码如下:
rsync --delete-before -d -a -H -v --progress --stats /data/blank/ /var/edatacache/