Find with -mtime is finding EVERYTHING since, not everything older than
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Find with -mtime is finding EVERYTHING since, not everything older than
I have a backup directory created each night with over 100 Gb of data in it. As you might expect, it is organized with sub-directories and files within each.
I simply want to delete the entire tree where the highest level sub-directory is over x days old.
First, the ls showing the contents:
ls -l
total 12
drwxr-xr-x. 34 root root 4096 Aug 14 15:25 20170814-102714
drwxr-xr-x. 34 root root 4096 Aug 15 03:43 20170815-020101
drwxr-xr-x. 34 root root 4096 Aug 16 05:42 20170816-020101
Thanks, but using + returns nothing, even if I use +1. Same results with/without -daystart
Just as further clarification, these directories are created and never touched again. So, the creation date = modification date.
I have also tried -ctime but no better results.
The first of these backups was not created via cron job, but manually in the afternoon of 8/14. In the future, they will all be at 3 AM. So, the fact that the "+2" test didn't return anything wasn't too surprising. I will try it with +2 later today before finalizing the purge script and implementing in cron.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.