Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to copy Softlinks and Hardlinks on Solaris system

807578Dec 11 2008 — edited Dec 11 2008
hello...

I am solaris system. I want to copy two files to another folder, one of which is independent and other is Softlinked to first one.
Whenever I am using 'cp -p file1 file2', It only copy files i think, but not the links itself.

Following is the output I am getting

-bash-3.00# vi try1
-bash-3.00# ln -s try1 try2
-bash-3.00# ls -l
total 6
drwxr-xr-x 2 root root 512 Dec 11 19:25 copy_dir
-rw-r--r-- 1 root root 28 Dec 11 18:59 try1
lrwxrwxrwx 1 root root 4 Dec 11 18:59 try2 -> try1

-bash-3.00# cp -p try2 ./copy_dir/

-bash-3.00# ls -l ./copy_dir/
total 2
-rw-r--r-- 1 root root 28 Dec 11 18:59 try2
-bash-3.00# cp -p try1 ./copy_dir/
-bash-3.00# ls -l ./copy_dir/
total 4
-rw-r--r-- 1 root root 28 Dec 11 18:59 try1
-rw-r--r-- 1 root root 28 Dec 11 18:59 try2
-bash-3.00#
-bash-3.00#


why file try2 doesn't show link with file try1 as it was showing earlier...

???
??

Please help me...
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 8 2009
Added on Dec 11 2008
2 comments
115 views