How to Use rsync to delete massive files in CentOS

Source: Internet
Author: User

Yesterday, we encountered a situation where we wanted to delete a large number of files in Linux. We needed to delete several 100,000 files. This is the log written by the previous program, which is growing fast and useless. At this time, the common delete command rm-fr * is not easy to use, because it takes too long to wait. Therefore, we must take some extraordinary measures. We can use rsync to quickly delete a large number of files.

1. Install rsync first:


Yum install rsync

2. Create an empty folder:


Mkdir/tmp/test

3. Use rsync to delete the target directory:


Rsync -- delete-before-a-H-v -- progress -- stats/tmp/test log

In this way, the log directory to be deleted will be cleared and the deletion speed will be very fast.


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.