How can you replace all symbolic-links in a directory (and children) with their targets on Mac OS X? If the target is not available, I'd prefer to leave the soft link alone.
How can you replace all symbolic-links in a directory (and children) with their targets on Mac OS X? If the target is not available, I'd prefer to leave the soft link alone.
Here are versions of chmeee's answer that uses
readlink
and will work properly if there are spaces in any filename:New filename equals old link name:
New filename equals target name:
You didn't say what names the files should have after the replacement.
This script considers the replaced links should have the same names they had as links.
If you want the files to have the same name as the target, this should do.
If you are using mac OSX aliases, then
find . -type l
won't come up with anything.You can use the following [Node.js] script to move/copy the targets of your symlinks to another directory: