[SunHELP] cp -r & symlinks

George Munk MUNKG at iomega.com
Tue Nov 12 12:03:30 CST 2002


Mark,

If you are using Sun's tar, it is trying to extract to /cdrom since an
absolute path was used to create the tar "file". Tar writing to the
cdrom is probably what is causing the error messages. Try...

cd /
tar cf - cdrom | (cd /destination && tar xf -)

In general, an absolute path should not be used to copy a directory
structure with this method because you would end up over-writing the
source directory structure no matter where the "cd /destination" goes. I
trust that Dale's original suggest which included the leading "/" was a
typo.

If GNU tar is being used, by default it strips off any leading "/" when
files are extracted from a tar file.


Regards,
George Munk

> -----Original Message-----
> From: Markham, Richard [mailto:RMarkham at hafeleamericas.com]
> Sent: Tuesday, November 12, 2002 10:51 AM
> To: Sunhelp (E-mail)
> Subject: RE: [SunHELP] cp -r & symlinks
>
>
> have you dealt with any tar: * cannot create errors or cannot
> set time when
> using that method?
> its almost as it its trying to use the cdrom as a temporary
> stage point on
> my end...
>
> -----Original Message-----
> From: Dale Ghent [mailto:daleg at elemental.org]
> Sent: Wednesday, October 09, 2002 1:23 AM
> To: Markham, Richard
> Cc: Sunhelp (E-mail)
> Subject: Re: [SunHELP] cp -r & symlinks
>
>
> On Fri, 4 Oct 2002, Markham, Richard wrote:
>
> | It appears that cp -r /cdrom/* will recurse through the cdrom0
> | symlink as well as the directory it points to as well.  I did
> | a seperate test by doing a cp -r /cdrom/cdrom0, hoping it would
> | only copy the link and not follow it, but it copied the target as
> | well.  Is there anyway I can get cp to recurse without following
> | symlinks?
>
> No. Use tar instead.
>
> tar cf - /cdrom | (cd /destination && tar xf -)
>
> /dale
> _______________________________________________
> SunHELP maillist  -  SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp



More information about the SunHELP mailing list