Can automator create symlinks but skip existing files? Today I discovered the awesome Create Symlinks action from JuneCloud.  It works great, but creates duplicate files (appending a number to each one) for any symlink that already exists in the final location.  I want it to just ignore those files and keep on trucking.

I tried using a shell script ln -s but that just plain fails with a The action “Run Shell Script” encountered an error. message after hitting a file that already exists.

Is there a way to create a symlink but SKIP existing files?  I know I can us -f to overwrite but I'd rather just skip.  How can this be done either in Automator or shell script?
Yes! You can do it easily in the shell script. The -h flag fits the bill, as described (sort of) on the ln man page. So instead of doing ln -s, do ln -sh.

Here's an example. Say you wanted to make a symbolic link of each of your downloads, which would exist on your Desktop, but you already have some symbolic links there. Then you could do this:

cd Downloads
for f in *; do ln -sh ~/Downloads/"$f" ~/Desktop; done;


For any files that you have that you already have symbolic links for, the command will print out:

    ln: /Users/******/Desktop/FlashPlayer.dmg: File exists


The command does this printing after running so it does not throw any errors nor require any additional inputs.