Hello,
I am new to this forum. I came to be here whilst looking for a script to change the creation and modification dates on a bath of photos, based on the filename of the photos.
I found a script here that can do this. It’s posted here: http://macscripter.net/viewtopic.php?id=35725
The script is:
set changeFileDatesPath to (path to desktop as text) & "ChangeFileDates"
set movieFolder to choose folder with prompt "Choose the folder with the movies!"
-- get all the files in the folder
tell application "Finder"
set theFiles to (files of movieFolder whose name extension is "jpg") as alias list
end tell
-- change the creation and modifcation date of every file
repeat with aFile in theFiles
tell application "Finder" to set thisName to name of aFile
set theYear to text 5 thru 8 of thisName
set theMonth to text 9 thru 10 of thisName
set theDay to text 11 thru 12 of thisName
set theHour to text 14 thru 15 of thisName
set theMinutes to text 16 thru 17 of thisName
set theSeconds to text 18 thru 19 of thisName
set creationDate to theMonth & "/" & theDay & "/" & theYear & space & theHour & ":" & theMinutes & ":" & theSeconds
do shell script quoted form of POSIX path of changeFileDatesPath & " -cDate " & quoted form of creationDate & " -mDate " & quoted form of creationDate & " -file " & quoted form of POSIX path of aFile
end repeat
The above includes a few modifications from the original. I changed it to look for jpg rather than mov files. I also changed the “text * through *” parts… to match the filename structure of my images.
I am pretty new to AppleScript. When running the script it gives me the error:
I am not sure why.
I am running the script from within AppleScript Editor.
If I set up a dictory at /Users/jonathan/Desktop/ChangeFileDates I get the error
. So I figured that was not the answer.
I have saved the script to /Users/jonathan/Desktop/ChangeFileDates.sh - thinking perhaps that was what’s necessary. Didn’t help.
So although I am sure this is very simple, I have come unstuck.
I would greatly appreciate a tip to set me in the right direction with making this work.
Thank you,
Jonathan