Find symbolic links (’s names) with Spotlight (Finder)

Solution 1:

You can use the find command to show you the target of the symlink then have awk throw away the rest of the line. Then wrap that in a loop that tells you what it's doing then feeds the names to mdimport:

for linktarget in $(find ${HOME} -type l -ls | awk -F'-> ' '{print $NF}'); do
    echo "importing ${linktarget}"
    mdimport "${linktarget}"; 
done

It's probably easier to cut and paste this little script since there are some spaces that are easy to miss. (like the one after the arrow in the awk statement).