Script to tar up old log files

Hell All! I need help writing a script for my job. I never really wrote alot of scripts but I guess it a first time for everything. I need to write a simple script that goes out to our log file directory on our servers and tar and compress them. I need to know how to add an date time stamp to tell which logs to tar up and compress. Can someone please help me wiht this?

Any chance you can show us what you have ???

Don't know, but maybe :

mkdir /dir/to/my/path/tmp

for i in `find /dir/to/my/path -type f -mtime +10`
do
mv $i /dir/to/my/path/tmp
done

tar cvf /tmp/backup_file.tar /dir/to/my/path/tmp
rm -r /dir/to/my/path/tmp

Regs David

As Davidg has shown in his example, you can find a set of files by evaluationg the modification time for the file. Check out the find and look specifically at the -mtime flag.

I want to say Thank You to the members that help me out with my question. I finish my script and it works great. Thank you all. :slight_smile:

hi aojmoj...

is it okay if you can post your script here???

Thanks & congrats you manage to create your script... :slight_smile: