You can use cp -P or –no-dereference options to never follow symbolic links in SOURCE.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
mkdir -p mydir1/mydir11 mydir2 ## create some files and directories ln -s mydir1 mylink1 echo "one" > mydir1/myfile1 echo "two" > mydir1/mydir11/myfile11 cd mydir1 ln -s mydir11 mylink11 ## create a symbolic link mylink11 pointing to mydir11 cd .. ls -R ## check directory structure, you can use tree as well cp -RP mylink1 mydir2 ## never follows symbolic links in SOURCE ls -R ## check directory structure, you can use tree as well rm -r my* |