A combination of the Linux command find and MV: Find files, move to a directory

Source: Internet
Author: User

Show Top 10 files

[Email protected] smgpbi]# Ls-1 | Sort-u | Head-10

1. First look at the number of files, enter the location of the file

# Find. -name "*" | Wc-l

Or

# ll |grep "^-" |wc-l

2. View the number of files

See the number of files 120 days ago

# Find. -mtime +120 | Wc-l

Generally if it is a small file, control at about 10.2 million.

Explanation:-mtime +30--Setup time is 30 days ago;

-exec MV-Perform the move operation after the search is completed;

3. Move to the specified directory by time

# Find. -mtime +90-exec mv {}/var/tmp/date_90 \;

4. Calculate the size

# du-sh date_90

Size general control in 10-15g best

5. Compress and Package

#tar-ZCVF date_90.tar.gz date_90/

A combination of the Linux command find and MV: Find files, move to a directory

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.