howto

Matthew Seaman m.seaman at infracaninophile.co.uk
Wed Apr 7 09:35:39 PDT 2004


On Wed, Apr 07, 2004 at 09:13:19AM -0400, Clint Gilders wrote:
> Matthew Seaman wrote:
> >On Wed, Apr 07, 2004 at 04:06:18AM -0400, Jerry Hatok wrote:

> >>  I am trying to copy files from a cd I have into my usr directory.  The 
> >>  cd has one directory with a lot of subdirectories and files.  Is there 
> >>  a command that I can copy everything at once? If so what is it?  If not 
> >>  what would you suggest being the fastest way to copy everything?

> >There's many, many ways of doing this sort of thing under Unix.
> >Assuming that your CD Rom is mounted under /cdrom and you want to copy
> >everything onto /home/jerry/cdimage then:
> >
> >    % cd /cdrom
> >    % mkdir /home/jerry/cdimage
> >    % tar -cvf - . | ( cd /home/jerry/cdimage ; tar -xvpf - )
> >
> >However there are any number of commands you could substitute for that
> >3rd line:
> >
> >    % find . -depth -print | cpio -pdmu /home/jerry/cdimage
> >
> >or, if you're installed the net/rsync port:
> >
> >    % rsync -avx --delete /cdrom/ /home/jerry/cdimage/
> 
> Are these not a little bit of overkill?  Seems to me (in this case) it 
> could be as simple as:
> 
> cp -Rp /cdrom/ /home/jerry/

Like I said: TIMTOWTDI.  However, I tend not to think of cp(1) in the
first instance because historically it tended to do nasty things, like
turn sym-links into real files.  Of course, the cp(1) in the system
today is much better behaved than that, and your suggestion certainly
does have merit.

There is still this caveat in the cp(1) man page:

           Note that cp copies hard linked files as separate files.  If you
           need to preserve hard links, consider using tar(1), cpio(1), or
           pax(1) instead.

but that is unlikely to be anything that affects the OP -- I'm not
even sure if the iso9660 filesystem on CD Roms even supports hard
links.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040407/e9e5636a/attachment.bin


More information about the freebsd-questions mailing list