Thanks for the code. I went through it and it makes sense to me. The part that says 'newer somefile' is apparently the place where I would put the calculation for determining the files that are over thirty days old. I don't know how to create that code. The original file name has the name of the data base and the name of the cron and the date created as the following: mydate="`date +"%m%d%y%H%M"" What would be the simplest way to determine the files that are over thirty days old? Thanks for any help, Eileen La Fond Work Phone: (206) 386-0011 -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of qubit Sent: Friday, June 25, 2010 6:47 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: A unix cron job question try the find command for F in `find directory -type f ! -newer somefile -print`; do echo "deleting $F"; rm $F done hope I'm remembering right -- I used to be a wild and crazy script writer. Happy hacking. --le ----- Original Message ----- From: "Lafond, Eileen" <Eileen.Lafond@xxxxxxxxxxx> To: <programmingblind@xxxxxxxxxxxxx> Sent: Friday, June 25, 2010 5:29 PM Subject: A unix cron job question We run many cron jobs daily that create a log file per cron job. This creates many log files over time. I think that we have about 33000 files right now. I am trying to create a cron job that will run once a month and delete all the log files that are more than thirty days out. I am trying now just to put the specification document together and I am having a difficult time with the details of the code. I was thinking of using the following: mydate="`date +"%m%d%y%H%M"" I cannot figure out how to write the code to go thirty days back and when I get that, I will then create a delete statement to delete the rest of the files. Does anyone have any idea as to how I can use the mydate above to figure out thirty days bac? Or am I doing this the wrong way and there might be an easier way to do it? Thanks for any help. Eileen La Fond Work Phone: (206) 386-0011 Email: Eileen.lafond@xxxxxxxxxxx __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind