Go Back   The UNIX and Linux Forums > Operating Systems > Solaris
google site



Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Search this Thread
  #1  
Old 07-31-2008
Registered User
 

Join Date: Oct 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
How to copy a symbolic link

Hi I am trying to find a copy command that will copy a symbolic link itself and not what the link is actually pointing to. I am trying to copy a directory that has some symbolic links within it

in IBM AIX unix this is achieved using cp -prh <source dir> <target>

the 'h' flag is a hard copy which copies the link itself

However there appears to be no similiar flag in Solaris

Any idea how I do this in Solaris ?
Sponsored Links
  #2  
Old 07-31-2008
Registered User
 

Join Date: Jul 2008
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Hi ,

Can u try it out by taring in the directory and then copy it so that the link would be maintained.

Thnks,
jega
  #3  
Old 07-31-2008
Registered User
 

Join Date: May 2008
Location: SINGAPORE.. The "FINE" City
Posts: 2,671
Thanks: 0
Thanked 8 Times in 8 Posts
Can you tar (CD && tar) the structure to maintain the links?
mv should retain links as well but they remain relative if the node is created that way.
eg tar cf - ./some_dir | ( cd /untar_here_dir && tar xfB - )

Again, relative links to a file not part of your copied structure will be broken. if you find the need for such links and the possibility of copying them around is a lot you, will need to set the ./link -> /path/to/location/of/file accordingly.
  #4  
Old 07-31-2008
Registered User
 

Join Date: Apr 2008
Location: Frankfurt a.M.
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
cd "dir"
find . | cpio -pmadv /new_dir
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
tar the symbolic link ganga.dharan Shell Programming and Scripting 1 05-23-2008 07:11 AM
need some info about symbolic link and hard link detective linux UNIX for Dummies Questions & Answers 2 01-08-2008 06:36 AM
Symbolic Link Confusion Sepia UNIX for Dummies Questions & Answers 5 05-07-2007 05:40 PM
symbolic Link bhargav UNIX for Dummies Questions & Answers 1 10-15-2004 09:41 AM
get symbolic link file andrec UNIX for Dummies Questions & Answers 11 11-13-2001 02:41 PM



All times are GMT -4. The time now is 09:22 PM.