sorry for '-4' ... it's 4 or +4 ... regards, -ionut- __________________ rm -rf `find /archive/backup/sql* -ctime -4` find /archive/backup/sql* -ctime -4 -print | xargs rm -rf regards, -ionut- linux@nittanytrav el.com To: shrike-list@xxxxxxxxxx Sent by: cc: shrike-list-admin Subject: RE: Scripting Question @redhat.com 10/15/2003 01:39 PM Please respond to shrike-list > -----Original Message----- > From: shrike-list-admin@xxxxxxxxxx > [mailto:shrike-list-admin@xxxxxxxxxx] On Behalf Of Stephen Mah > Sent: Tuesday, October 14, 2003 7:49 PM > To: shrike-list@xxxxxxxxxx > Subject: Re: Scripting Question > > > you can probably use the find command, to find files that are > older than > 4 days. Use the -exec option to remove the file. > > Jake McHenry wrote: > > Hi everyone, > > > > I made up a script that backs up my mysql database into a > compressed > > file. What I want to do now it make it only keep the last 4 days, > > anything older than that it will delete, basically the same thing > > logrotate does. > > > > Is there a way for me to do this in a bash script? > > > > The files are named: sql_10142003.sql.gz > > > > Jake McHenry > > Nittany Travel MIS Coordinator > > http://www.nittanytravel.com > > > > > > > > -- > Shrike-list mailing list > Shrike-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/shrike> -list > Something like this? find /archive/backup/sql* -mtime 4 -exec rm -f -r That gives me an error: find: missing argument to `-exec' The man page isn't very good on find. It helped a lot, but some of the stuff is kinda fuzzy. Jake -- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect those of J.P. Morgan Chase & Co., its subsidiaries and affiliates. -- Shrike-list mailing list Shrike-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/shrike-list