FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 09-03-2011, 07:58 AM
Rodolfo Medina
 
Default About the `-u' option of `cp' command

Hallo, Debian users.

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?

Thanks for any help
Rodolfo


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87ehzyukew.fsf@gmail.com">http://lists.debian.org/87ehzyukew.fsf@gmail.com
 
Old 09-03-2011, 08:25 AM
Sven Joachim
 
Default 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


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87obz258x7.fsf@turtle.gmx.de">http://lists.debian.org/87obz258x7.fsf@turtle.gmx.de
 
Old 09-03-2011, 08:55 AM
Ivan Shmakov
 
Default 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)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 8639ge9f8m.fsf@gray.siamics.net">http://lists.debian.org/8639ge9f8m.fsf@gray.siamics.net
 
Old 09-03-2011, 09:17 AM
Andrew McGlashan
 
Default About the `-u' option of `cp' command

Hello,

Rodolfo Medina wrote:

Hallo, Debian users.

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


Why not use rsync for this?

Cheers

--
Kind Regards
AndrewM

Andrew McGlashan
Broadband Solutions now including VoIP


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: 4E61F09B.2040907@affinityvision.com.au">http://lists.debian.org/4E61F09B.2040907@affinityvision.com.au
 

Thread Tools




All times are GMT. The time now is 04:08 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org