Is it possible to skip a file rename when it's not there in Automator? I have written a little Automator script that does the following tasks:


Get Specified Finder Items - to get one file
Rename Finder Items: Name Single Item - to rename that to .old
Get Specified URLs - to pull a plugin down from a GIT repo
Download URLs - to save the resulting URL to a file
Get Specified Finder Items - to find the renamed .old file from step 1
Move Finder Items to Trash - to remove .old file


The purpose is to grab the latest copy of a TernJS plugin and place it in the correct location for Atom Ternjs plugin for Atom.io.  It works well when the file in question is already there, but if it's not it blows up on the Rename step. So, it it possible to either tell the Rename step to never fail OR somehow skip the step in the case where no files were found?
I wrote a small JavaScript for Automation program that may be able to accomplish what you want to do. It checks for and deletes the existing file, then proceeds to download the desired file from the GIT repository:

// Get Finder application
finder = Application('Finder')
finder.includeStandardAdditions = true

// Create path to the location of the existing file
path = Path("path/to/destination")

// Check to see if the old file exists
if (finder.files.length &gt; 0) {
    oldFile = finder.files[0]
    oldFile.delete()
}

// Use curl to download the new file
current = Application.currentApplication()
current.includeStandardAdditions = true
theURL = "http://url/to/git/plugin"
current.doShellScript("curl -L " + theURL + " -o " + path.toString())


Alternatively, you could take some portion of this code (such as the conditional that determines whether there is an existing file) and put it into an Automator "Run JavaScript" action in your existing script.