I record radio programs during the night and then run an applescript to rename the files. I have the script working unless there is no file named that I am attempting to call and rename. Here is my code that is working:
set Yesterday to (current date) - (24 * 60 * 60) set myYesterday to (date string of Yesterday) set y to year of date myYesterday set m to month of date myYesterday set d to day of date myYesterday set newMyYesterday to m & " " & d & ", " & y as text set newHourOne to "Recording1 - " & newMyYesterday & " - Hour 1.mp3" set theFile to (POSIX file "/Users/Administrator/Recordings/Recording1.mp3") as alias tell application "Finder" set the name of file theFile to newHourOne end tell set newHourTwo to "Recording2 - " & newMyYesterday & " - Hour 2.mp3" set theFile to (POSIX file "/Users/Administrator/Recordings/Recording2.mp3") as alias tell application "Finder" set the name of file theFile to newHourTwo end tell
Can someone please show me how to check to see if the individual file ("Recording1.mp3" or "Recording2.mp3") exist before trying to rename the individual file? Thanks!!