Avatar of jcob_l
jcob_l asked on

meaning

Can you please tell me the meaning of this

find /backup/logs/ -name daily_backup* -mtime +21 -exec rm -f {} ;


?

find /backup/logs/daily_backup* -mtime +5 -exec rm -f {} \;

?

find /backup/logs/daily_backup* -mtime +5 -delete;

?
Linux

Avatar of undefined
Last Comment
jcob_l

8/22/2022 - Mon
farzanj

find /backup/logs/ -name daily_backup* -mtime +21 -exec rm -f {} ;

Find files in  /backup/logs/ directory with name daily_backup* (any characters or nothing after backup) that are more that 21 days old and remove them.
This command should have \; at the end or "{}" in quotations


find /backup/logs/daily_backup* -mtime +5 -exec rm -f {} \;
Find files in folders similar to /backup/logs/daily_backup* (anything after backup) that are more than 5 days old and remove them


find /backup/logs/daily_backup* -mtime +5 -delete;
Again find files more that 5 days old and delete them.

NOTE: mtime takes file's last modified time
* would mean 0 or more characters except for / that would mean next item in the path

For more examples, consult
http://www.cyberciti.biz/faq/howto-find-delete-empty-directories-files-in-unix-linux/
ASKER CERTIFIED SOLUTION
Tintin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
jcob_l

yes
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23