UPDATE:
Modified the file path and it worked to change the modified date/time but for some reason not the create date/time. Also would not work with the -m or -a operators.
tell application "Finder"
set selectedFiles to (get selection)
repeat with i from 1 to count of selectedFiles
set thisFile to item i of selectedFiles
set thisName to name of thisFile
set yy to first word of thisName
set newDate to yy & "01010000"
do shell script "touch -t " & newDate & " /Users/usernamehere/Desktop/TempPhotos/" & quoted form of thisName
end repeat
end tell
Post
Replies
Boosts
Views
Activity
Thank you for explanation. That helped me understand the issue and I’ll check out setfile
After doing some research it appears this may have something to do with Unix/Posix Epoch time (1970 - 2038). If that’s the case then there’s no work around. You can’t use any year outside that range.
So, if you have a few thousand scanned photo files from the 20’s, 30’s, 40’s, 50’s and 60’s like I do you can’t set the create date to reflect when the photo was taken. Only the day it was scanned.
Again, thank you. Second time you've given me good insight.
I wouldn't have gone down this path if it wasn't for the way dates are (or are not) captured during scanning as well as how Apple Photos imports images. There have even been times when the camera, scanner or Photos app has butchered the create date on import.
Philosophically, I agree with your observation that the file create date is indeed that and should be sacrosanct. But I can't control what date Photos uses on import. I'd love to direct it to use a specific EXIF tag.
Bottom line...I've got over 34,000 images in the photos app and adding another 4-5,000 shortly. Importing photos that were taken several decades ago and giving them a current date of the scan doesn't allow me to sort the images chronologically which can be a monumental hassle when you're looking for something specific. Photo's of my great grandparents in 1890's mixed in with photos of my kids in 70's and 80's. It becomes a mess quickly.
Apparently, Apple has recognized this problem and Photos does allow you to manipulate the create date manually after import but its tedious and inefficient to change thousands of photos that way. So, I figured since the file name has the year the photo was taken, if I change the file create date to match before import, I'd be saved myself allot of time making manual updates later. It's not a perfect solution since in many cases I don't know the exact day or time the photo was taken, but it does get my photos into the proper order by year.
Anyway, many thanks for the assist and the code sample... I'll be experimenting with it shortly.