How to copy a symbolic link


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Old 07-31-2008
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 ?
# 2  
Old 07-31-2008
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
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
cd "dir"
find . | cpio -pmadv /new_dir
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
awk symbolic link xpukm Shell Programming and Scripting 1 11-20-2013 06:01 PM
Symbolic link yifangt UNIX for Dummies Questions & Answers 4 02-06-2013 04:47 PM
How to list all symbolic link? avtalan How to Post in the The UNIX and Linux Forums 2 11-02-2012 01:16 PM
How to list all symbolic link? avtalan Shell Programming and Scripting 1 11-02-2012 12:56 PM
[Solved] Symbolic link not allowed or link target not accessible newbielgn UNIX for Dummies Questions & Answers 0 09-04-2012 11:21 AM
ls on a symbolic link newbie_01 Shell Programming and Scripting 7 08-30-2012 09:17 AM
issue with Symbolic link kumarmani Solaris 4 12-28-2011 06:19 AM
Symbolic Link Help LAVco Shell Programming and Scripting 2 06-07-2010 03:15 PM
symbolic link tonijel Shell Programming and Scripting 2 10-01-2009 06:23 AM
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
1 symbolic link to 2 different places? Bashar UNIX for Advanced & Expert Users 2 08-27-2003 07:40 AM
get symbolic link file andrec UNIX for Dummies Questions & Answers 11 11-13-2001 02:41 PM