How to delete massive data files in seconds

Source: Internet
Author: User
Tags inotify rsync rsync usage

In O & M, sometimes we need to delete large files, or N (N is infinite ~~) Multiple small files

So, rm,

Here, Rocky introduces the most cute, gentle, mature, kind and kind of Linux in history.

This is another method of rsync.

① Syntax:

# Rsync -- delete-before-avH -- progress -- stats DEST SRC

Explanation:

When SRC and DEST are both objects [f], this indicates clearing the object content rather than deleting the object.

When SRC and DEST are both directories [d], it means to delete all files in the directory and change it to an empty directory.

PS: in fact, this command is very memorable, such as av-_-#, H $ _ $, cool, who are your hard drive at this time ,,

② Principle:

Rsync actually uses the replacement principle

③ Advantages:

Processing speed is quite fast. Processing Several GB of files is a matter of seconds, which is much faster than rm.

④ Disadvantages:

High Disk io usage, business peaks, or temporary avoidance

⑤ Test:

[Root @ localhost log] # ls
Rhel-server-5.8-i386-dvd.iso
[Root @ localhost log] # pwd
/Tmp/test/log
[Root @ localhost ~] # Mkdir empty
[Root @ localhost ~] # Rsync -- delete-before-avH -- progress -- stats/root/empty // tmp/test/log/
Building file list...
1 file to consider
Deleting rhel-server-5.8-i386-dvd.iso
./

Number of files: 1
Number of files transferred: 0
Total file size: 0 bytes
Total transferred file size: 0 bytes
Literal data: 0 bytes
Matched data: 0 bytes
File list size: 19
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 29
Total bytes encoded ed: 15

Sent 29 bytes encoded ed 15 bytes 6.77 bytes/sec
Total size is 0 speedup is 0.00

Recommended reading:

Complete rsync synchronization Configuration

Use rsync to synchronize files between Windows and Linux machines

Rsync + inotify combined synchronization Solution

Real-time backup configuration of Rsync and inotify files

Explanation of Rsync usage skills and permissions in CentOS 5.5

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.