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

Re: About the `-u' option of `cp' command



On 2011-09-03 09:58 +0200, Rodolfo Medina wrote:

> In `cp' man it is said:
>
> -u, --update
>               copy only when the SOURCE file is  newer  than  the  destination
>               file or when the destination file is missing
>
>
> 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.

Sven


Reply to: