Re: About the `-u' option of `cp' command
>>>>> Sven Joachim <svenjoac@gmx.de> writes:
>>>>> On 2011-09-03 09:58 +0200, Rodolfo Medina wrote:
[…]
>> Now, it happens sometimes to me that, even with `-u', `cp' will copy
>> the file also when it isn't newer at all than the destination file,
>> as here:
>> $ ls -lh ing.tex /mnt/pendrive2/ing.tex
>> -rw-r--r-- 1 rodolfo rodolfo 163K 2011-08-31 18:44 ing.tex
>> -rwxr-xr-x 1 rodolfo rodolfo 163K 2011-08-31 18:44 /mnt/pendrive2/ing.tex
>> $ cp -viup ing.tex /mnt/pendrive2
>> cp: overwrite `/mnt/pendrive2/ing.tex'?
>> Why this, and how to avoid it?
> Might be due to high resolution timestamps on the source filesystem,
> but not on the target (the pendrive seems to have an FAT filesystem).
> Use the --full-time ls option to find out.
Please note that the filesystems of the FAT family have 2 second
time resolution, while the usual Unix filesystems have 1 second
resolution at worst. Therefore, the original file may be
18:44:55, and the destination is 18:44:54 (i. e., time gets
truncated.)
Using rsync(1) and --modify-window= will probably solve the
problem. Consider, e. g.:
$ rsync -v -urt -O --modify-window=1 -- \
ing.tex /mnt/pendrive2/
(The -v -urt Rsync options roughly correspond to the -v -urp
cp(1) ones.)
--
FSF associate member #7257 Coming soon: Software Freedom Day
http://mail.sf-day.org/lists/listinfo/ planning-ru (ru), sfd-discuss (en)
Reply to: