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

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



> 
> 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.

I do not think there is a preserve function in cp..  You can do this
with a tar such as..

tar cf - filename(s) | ( cd destination_directory; tar xvf - )

This will preserve date stamps, ownership, etc..


> 
> 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 ??

A smallish script could do this..  Not the cp command by itself...

It is a simple script but I don't have the time to write it for you
now..  I will do it later if I get time..