title: AppleScript: If a file does not exist
body: <p>I need some way to determine if a particular file exists. If it exists do one script if not then do another script. Here was my logic in applescript:</p>
  
  <pre><code>If exists "File:Path:To:theFile"
  
  tell application "Finder"
  open "File:Path:To:the:script"
  end tell
  
  else
  
  tell application "Finder"
  open "File:Path:To:the:Anotherscript"
  end tell
  
  end if
  </code></pre>
  
  <p>The only problem is that sometimes when i use the above logic the script fails saying can't find the file. I need a full proof, never fails way to see if a file exists. I'm open to using the terminal, or applescript. I'm sure someone has run into this before but I have looked all over the web for an answer but could not find one.</p>