Can be used to empty directories or files, as follows: 1, first set up an empty directory mkdir/data/blank 2, remove the target directory with rsync rsync--delete-before-d/data/ blank//var/spool/clientmqueue/ so the target directory is quickly emptied If you have some very large files to delete, For example, nohup.out such as real-time update of the file, at every turn dozens of g on hundreds of G, can also www.cit.cn to use rsync to empty large files, and high efficiency 1, create an empty file touch /data/blank.txt 2, use rsync to empty files rsync-a--delete-before--progress--stats/root/blank.txt/root/nohup.out& nbsp Building file list ... 1 file to consider blank.txt 0 100% &nbs P 0.00kb/s 0:00:00 (xfer#1, TO-CHECK=0/1) Number of files:1 number of files Transferr ed:1 Total File size:0 bytes Total transferred file size:0 bytes Literal data:0 bytes matched data:0 bytes File list size:27 file list generation time:0.006 seconds file list transfer time:0.000 seconds Total Bytes sent:73 Total bytes received:31 www.cit.cn Sent bytes received bytes 208.00 bytes/sec total size is 0 speedup is 0.00 tips: error when SRC and dest files are inconsistent when SRC and dest properties are file "F", it means emptying the contents of the file instead of deleting the file When the SRC and Dest properties are both directory "D", it means to delete all files under the directory and make them empty most importantly, it is handled fairly quickly, processing a few G files that is the second level the core content is: Rsync actually uses the replacement principle
The
quickly deletes large files and a large number of small files.