delete files older than 7 days Except on saturdays
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!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
How are the backup files created?
How are the backup files named?
Are you just searching the current directory?
Some off the top ideas.
Append SAT to your backup file names and use the above posted find command that excludes SAT.
Create the Sat backup files in another directory. Limit the find command to not search that directory.
Loop through those files that are older then 7 days and check the atime/ctime. Delete those files not created on a Sat.
Thank you all! that is a great idea.
i'll just backup the saturday backups into a different folder and operate the "rm" on the regular backups folder.
i just need to be carefull not to delete the script itself, since it is inside the folder of the backup and older than 7 day
If you wish to keep the script in the same directory you could regen it via cron script (if file doesn't exist then make it [source elsewhere]). I would prefer to have any executable in some other centralized location, but that's just my preference.
I'm a bit out of touch with Linux/Unix, so please excuse me for referencing any obsolete commands/programs and such...
Last edited by Mark Nagel; 03-17-2014 at 01:30 PM.