Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"cp -r " vs drag & drop
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Tue Sep 10, 2002 7:00 pm    Post subject: "cp -r " vs drag & drop Reply with quote

I have observed that in KDE, drag & drop is a lot more accurate than "cp -r". Every time I used "cp -r" to copy a large directory, some of the sub-directiories got corrupted. If I used drag & drop, all of them were fine.

Your opinion, please? :o
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Tue Sep 10, 2002 7:05 pm    Post subject: Re: "cp -r " vs drag & drop Reply with quote

The man page for GNU cp explains this in detail. Do you have the same problems using "cp -R"?
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Tue Sep 10, 2002 7:17 pm    Post subject: Reply with quote

info cp has some info as well.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
xming
Guru
Guru


Joined: 02 Jul 2002
Posts: 441

PostPosted: Tue Sep 10, 2002 7:59 pm    Post subject: Reply with quote

the "right thing" is

Code:

cd /dest_dir
tar cf - /src_dir | tar xvfp -


xming
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Tue Sep 10, 2002 8:09 pm    Post subject: Reply with quote

xming wrote:
the "right thing"

OK, I'm curious. Why is this method better than others?
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
kyron
Apprentice
Apprentice


Joined: 26 Aug 2002
Posts: 198
Location: Montreal, Qc.

PostPosted: Tue Sep 10, 2002 9:12 pm    Post subject: Reply with quote

xming wrote:
the "right thing" is

Code:

cd /dest_dir
tar cf - /src_dir | tar xvfp -


xming


Pwahaha....must admit...this is very colorful. Guess it's the "right thing" for people that have CPU cycles to loose :P... I'd rather think it's a misuse of cp (ie, using it as regular user, not calling "cp -Rp"). It would take a lot for me to be convinced that cp has corruption issues (I've used it quite a lot to move considerable amounts of data and files back and forth).
_________________
M$ Windows: When in doubt, REBOOT
Linux: When in doubt, RTFM ;-)
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Tue Sep 10, 2002 10:58 pm    Post subject: Reply with quote

tar is only useful when you want to bind everything into one file for easy archival or transmittal.

cp is made to copy. Thus, if you want to copy something, you don't use an archival tool :)
Back to top
View user's profile Send private message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Wed Sep 11, 2002 12:01 am    Post subject: re: cp vs drag & drop Reply with quote

>The man page for GNU cp explains this in detail. Do you have the same problems using "cp -R"?

I reread "man cp". One thing confused me is the definitions of the two options -r and -R.

-r copy recursively, non-directories as files WARNING:
use -R instead when you might copy special files
like FIFOs or /dev/zero

-R, --recursive
copy directories recursively


Does it mean that with -r, cp can copy files and with -R, it can only copy directories? and what are FIFOs and /dev/sero files?
:o
_________________
bluesky

"free as the wind"


Last edited by bluesky on Wed Sep 11, 2002 12:09 am; edited 1 time in total
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Sep 11, 2002 12:08 am    Post subject: Re: re: cp vs drag & drop Reply with quote

bluesky wrote:
Does it mean that with -r, cp can copy files and with -R, it can only copy directories?

No, rather that -r behaves like -R for files and directories, but not necessarily when it encounters other things like FIFOs. And, in fact, when encountering special things, GNU cp's -r option decides to, as its own manual admits, act rather silly.

I read the GNU cp man page as saying essentially this:
Quote:
Use -R to copy recursively. There is an -r option that sometimes does this too, but it is broken when it comes to special files and FIFOs. There is no reason to ever prefer -r over -R when using GNU cp.

_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Wed Sep 11, 2002 12:13 am    Post subject: re: GNU cp? Reply with quote

Aah. Now you mentioned GNU cp. I wonder what is it. I read the man pages from redhat and it did not explain the same.

I was working with redhat 7.3, so not in gentoo but I assume( ?) that their man page are the same. :o
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Sep 11, 2002 12:20 am    Post subject: Re: re: GNU cp? Reply with quote

bluesky wrote:
Aah. Now you mentioned GNU cp. I wonder what is it.

There are several different versions of fileutils, such as cp, rm, mv, etc. The one installed by default in Gentoo (and in every other free Unix implementation I've ever seen) is the one from the GNU project's fileutils package, which has a web site.

Quote:
I was working with redhat 7.3, so not in gentoo but I assume( ?) that their man page are the same. :o

Can't comment on this, as my experience with RedHat lasted exactly as long as it took to figure out how to replace it with Debian on my PowerMac 8100/80.

BTW, why are you always :o? What does that smiley mean, anyway?
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
bluesky
Apprentice
Apprentice


Joined: 14 Aug 2002
Posts: 230
Location: USA

PostPosted: Wed Sep 11, 2002 2:19 am    Post subject: re: cp varieties Reply with quote

Here are the definitions of -r and R in "man cp" from gentoo:

-R Copy directories recursively, and do the right
thing when objects other than ordinary files or
directories are encountered. (Thus, the copy of a
FIFO or special file is a FIFO or special file.)

-r Copy directories recursively, and do something
unspecified with objects other than ordinary files
or directories. (Thus, it is allowed, in fact
encouraged, to have the -r option a synonym for -R.
However, silly behaviour, like that of the present
GNU version of cp (see below) is not forbidden.)

I guess this is still not GNU cp's definition.
:)

And, rac, AS far as smileys are concerned, I do not pay much attention to their meanings details, whatever they are.
_________________
bluesky

"free as the wind"
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Wed Sep 11, 2002 2:21 am    Post subject: Reply with quote

:o = 'Surprised'. Not very clear if you ask me.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Sep 11, 2002 3:35 am    Post subject: Reply with quote

I must not be making much sense in this thread. Unless you have done something very unusual to your Gentoo system, /bin/cp is GNU cp, and the man page for cp (1) is the man page for GNU cp.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Wed Sep 11, 2002 3:46 am    Post subject: Reply with quote

When I 'man cp', I do not see the references you mentioned. Other than
man cp wrote:
-R, -r, --recursive
copy directories recursively
no mentions of an explanation.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Wed Sep 11, 2002 3:52 am    Post subject: Reply with quote

kanuslupus wrote:
When I 'man cp', I do not see the references you mentioned. Other than
man cp wrote:
-R, -r, --recursive
copy directories recursively
no mentions of an explanation.


Ditto...
I don't know what system everyone else is running, but the man page that comes with Gentoo basically states that -r, -R, and --recursive and synonymous.
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Sep 11, 2002 3:53 am    Post subject: Reply with quote

kanuslupus wrote:
When I 'man cp', I do not see the references you mentioned. Other than
man cp wrote:
-R, -r, --recursive
copy directories recursively
no mentions of an explanation.

Interesting. I have fileutils-4.1.8-r2, and it is the owner of the cp man page, and:
cp (1) man page wrote:
-r Copy directories recursively, and do something
unspecified with objects other than ordinary files
or directories. (Thus, it is allowed, in fact
encouraged, to have the -r option a synonym for -R.
However, silly behaviour, like that of the present
GNU version of cp (see below) is not forbidden.)

-r Copy directories recursively, copying any non-
directories and non-symbolic links (that is, FIFOs
and special files) as if they were regular files.
This means trying to read the data in each source
file and writing it to the destination. Thus, with
this option, `cp' may well hang indefinitely read-
ing a FIFO or /dev/tty. (This is a bug. It means
that you have to avoid -r and use -R if you don't
know what is in the tree you are copying. Opening
an unknown device file, say a scanner, has unknown
effects on the hardware.)

_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Wed Sep 11, 2002 3:59 am    Post subject: Reply with quote

Wierd...
are there two versions of fileutils-4.1.8-r2 floating around if some people see a detailed description.

Now I just did an "info cp" and got a detailed description:

Code:

`-r'
     Copy directories recursively, copying any non-directories and
     special files (e.g., symbolic links, FIFOs and device files) as if
     they were regular files.  This means trying to read the data in
     each source file and writing it to the destination.  It is usually
     a mistake to apply `cp -r' to special files like FIFOs and the
     ones typically found in the `/dev' directory.  In most cases, `cp
     -r' will hang indefinitely trying to read from FIFOs and special
     files like `/dev/console', and it will fill up your destination
     disk if you use it to copy `/dev/zero'.  Use the `--recursive'
     (`-R') option instead if you want to copy special files,
     preserving their special nature rather than reading from them to
     copy their contents.

`-R'
--recursive'
     Copy directories recursively, preserving non-directories (contrast
     with `-r' just above).


So, the info page has it, but not the man page.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Wed Sep 11, 2002 4:11 am    Post subject: Reply with quote

Same version of fileutils here as well.
tail end of 'man cp' wrote:
AUTHOR
Written by Torbjorn Granlund, David MacKenzie, and Jim
Meyering.

REPORTING BUGS
Report bugs to <bug-fileutils@gnu.org>.

COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying condi-
tions. There is NO warranty; not even for MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO
The full documentation for cp is maintained as a Texinfo
manual. If the info and cp programs are properly
installed at your site, the command

info cp

should give you access to the complete manual.




cp (fileutils) 4.1.8 March 2002 CP(1)

_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Sep 11, 2002 4:16 am    Post subject: Reply with quote

FWIW,
tail end of cp (1) man page wrote:
NOTES
This page describes cp as found in the fileutils-4.0 pack-
age; other versions may differ slightly. Mail corrections
and additions to aeb@cwi.nl. Report bugs in the program
to fileutils-bugs@gnu.ai.mit.edu.




GNU fileutils 4.0 1998-11 CP(1)

_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Wed Sep 11, 2002 4:20 am    Post subject: Reply with quote

I renamed entries for fileutils in distfiles & packages. emerging fileutils again produces the same man page.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Wed Sep 11, 2002 4:23 am    Post subject: Reply with quote

Sure looks like I have an old cp (1) man page that is more descriptive, eh?
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20054

PostPosted: Wed Sep 11, 2002 4:27 am    Post subject: Reply with quote

Sure does. The odd part is that you have the same version of fileutils installed.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
arkane
l33t
l33t


Joined: 30 Apr 2002
Posts: 918
Location: Phoenix, AZ

PostPosted: Wed Sep 11, 2002 7:15 am    Post subject: Reply with quote

Sounds like the free software folk are doing their damnedest to move everything over to info files.

ugh...
Back to top
View user's profile Send private message
dioxmat
Bodhisattva
Bodhisattva


Joined: 04 May 2002
Posts: 709
Location: /home/mat

PostPosted: Wed Sep 11, 2002 8:00 am    Post subject: Reply with quote

maybe the cp man page is actually is the manpages package...
I tried to use qpkg to find the package that owns my cp.1.gz but couldnt find it (however I'm not really a gpkg expert :) .

according to the man-pages web site, this pages is the cp manpage from the man-pages 1.47 :
http://www.cwi.nl/~aeb/linux/man2html/man1/cp.1.html ...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum