What is the simplest way of copying symbolic links on the Mac?
A python or perl solution would be preferred, but any solution would be a help.
I am copying frameworks for an installation package, and need the links to be maintained
We can use the -l option of rsync for copying symlinks. rsync copies the symlinks in the source directory as symlinks to the destination directory using this option. Copying the symlinks is successful in this case.
Find the file or folder you want to create a symlink for, right-click on it, and select Services followed by Make Symbolic Link. It'll create the symlink in the same folder as the original file/folder. You can move it around though if you want.
Press Command+Space, type “Terminal”, and then press “Enter” to open Terminal from Spotlight search. Navigate to Finder > Applications > Utilities > Terminal to launch the Terminal shortcut. The -s here tells the ln command to create a symbolic link. If you want to create a hard link, you'd omit the -s .
As David mentioned, OS X is missing the handy -a option that gnu cp has.
However, if you use -R to do a recursive copy, then it will copy symlinks by default, so
cp -R source destination
ought to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With