Shell finds files and deletes

Source: Internet
Author: User


-mtime 0 represents files that are currently 0 days away from the file modification time, which is less than 1 days (24 hours) away from the current time.
-mtime 1 is a file that is currently 1 days away from the file modification time, which is 1 days (24 hours-48 hours) from the current time.
-mtime+1 indicates file modification time is greater than 1 days file, that is, 2 days (48 hours) away from the current time
-mtime -1 means files with a file modification time of less than 1 days, i.e. files within 1 days (24 hours) from the current time


-type is a parameter to the Find command:
-type: Finding a document of a type
B: Block device documentation
D: Catalogue
C: Character device documentation
P: Piping Documentation
L: Symbolic Link Document
f: General documentation

eg: find a document and delete

find/var/log/*.log*-type f-mtime 0-exec rm-rf{} \


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Shell finds files and deletes

Related Article

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.