(summary) The fastest way to delete massive files using rsync under Linux

Source: Internet
Author: User
Tags rsync

Yesterday encountered the need to delete a large amount of files under Linux, you need to delete hundreds of thousands of files. This is a log of the previous program, growing fast and useless. This time, we often use the delete command RM-FR * is not useful, because the time to wait too long. So we have to take some very good measures. We can use rsync to quickly delete large numbers of files.

1. Install rsync First:
yum install rsync
2. Create an empty folder:
mkdir /tmp/test
3. Delete the target directory with rsync:
rsync --delete-before -a -H -v --progress --stats /tmp/test/ log/
The log directory that we want to delete will be emptied and deleted very quickly. Rsync actually uses the replacement principle, processing hundreds of thousands of files is also the second delete.

Option Description :
–delete-before the recipient to delete before transferring
–progress display the transfer process during transmission
-a archive mode that represents recursively transferring files and keeping all file attributes
-H Keep hard-connected files
-V Verbose output mode
–stats gives the transfer status of some files

(summary) The fastest way to delete massive files using rsync under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.