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

Re: can rsync correct dates?



Dr Beco <rcb@beco.cc> writes:

> On Mon, Sep 3, 2012 at 3:10 AM, lee <lee@yun.yagibdah.de> wrote:
>>> So, how do I compose such a command rsync plus find, to achieve this?
>>
>> You could
>>
>>
>> 1.) create a file with a list of such files with find and use the
>>     "--exclude-from=" of rsync to exclude them, or
>>
>> 2.) you could make another backup of the modified files, restore
>>     everything and then restore the modified files from the other
>>     backup.
>>
>>
>> I'd go for 2.) because I'd make another backup of the modified files
>> first anyway.
>>
>
> Hi Lee,
>
> Good suggestion to make another backup! I'll do it, but then, I'm
> trying to play with this command:
>
> $ find . -daystart -mtime -21 -printf "%f\n" | rsync -atI --progress
> /media/S2/home/beco/ . -ni --exclude-from=-
>
> But I'm not sure about the options to rsync. Do I need the capital I?
> and also -t?

Since you say that all the times have changed, there doesn't seem to be
much point in not skipping files that do have the same time, so -I is
probably not needed because there won't be any such files anyway. OTOH,
it probably won't hurt not to copy files that don't exist ;)

> The files are exactly the same but for the excluded list. So I really
> just need to update the dates.

When you read the manpage, it says:


,----
|        Rsync  finds  files  that  need  to  be transferred using a "quick
|        check" algorithm (by default)  that  looks  for  files  that  have
|        changed  in  size  or  in  last-modified time.  Any changes in the
|        other preserved attributes (as requested by options) are  made  on
|        the  destination file directly when the quick check indicates that
|        the file’s data does not need to be updated.
`----


This makes me think that rsync will do exactly what you need, with or
without the -I option.

The question is how well your solution will handle files to be excluded
which have spaces in their names (if you have such files). I'd write the
list into a file and check it first and do something else if there are
files with spaces in their names to avoid unpredictable results. Having
the second backup with the modified files at hand, you don't really need
to exclude those, do you?


-- 
Debian testing amd64


Reply to: