[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-users] O/T copying files in linux



Not strictly a cobalt question, but I expect somebody here will know
the answer to this.

I've got a cron job running that copies all the rotated logs from my
various sites into one location for easy downloading.  Here's an
example of one line:

cp /home/sites/site89/logs/web.log.1.gz
/home/sitelogs/images-web.log.1.gz

This works fine, but, the destination file assumes the file date/time
of when the copy is performed. I want it to retain the original file
date/time so I can easily see when a new rotations has occured by
sorting in date order.

How do I do this?

Second question: Is there an easy way of writing a single cp command
that will look through every virtual site and copy web.log.*.gz to
another location and rename it sitename-web.log.*.gz ??

Thanks!
Tim.