[CentOS] Re: Opposite of cp -u

Scott Silva ssilva at sgvwater.com
Tue Aug 7 22:30:23 UTC 2007


Robert Moskowitz spake the following on 8/6/2007 4:22 PM:
> Scott Silva wrote:
>> Robert Moskowitz spake the following on 8/6/2007 2:40 PM:
>>  
>>> I had at one point copied a large number of files between drives and did
>>> not use the -p and thus the timestamps were all set to the date of the
>>> copy.
>>>
>>> I did not catch this, and deleted the source.  So I 'lived' with it and
>>> have since changed many files.
>>>
>>> Well, yesterday I found a good backup of many of those files and I want
>>> to restore them to their proper dates.
>>>
>>> cp -p -u is exactly the opposite of what I want.  I want to copy only if
>>> the source files have an earlier date than the destination files.
>>>
>>> The source files are just an old copy on another drive that I found when
>>> cleaning up things...
>>>     
>> Can you restore the backups, and then cp -u from the existing
>> directory over
>> the restored copy?
> No.  Because all the files, changed or not since that date, are newer
> than what is on the backup.  So it would overwrite everything.
So all the files on the share that haven't changed are all roughly the same
date/time?
Maybe you could copy -p the files to a new location, and rm all the files that
have that date/time with a "find /newlocation -mtime -(rough days to common
time) -exec rm -f {} \;" and then merge the backup with this new directory.

-- 

MailScanner is like deodorant...
You hope everybody uses it, and
you notice quickly if they don't!!!!




More information about the CentOS mailing list