I've created an AppleScript to change the file creation dates for several hundred scanned images so that the dates reflect the actual date the photo was taken and not the date the image was scanned.
The script is as follows:
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 & "01010101.01"
do shell script "touch -t " & newDate & " " & quoted form of POSIX path of thisName
end repeat
end tell
When I run the script against one test file, I get the following:
Apparently the shell script is failing because the file is considered read only. I haven't tried it but I'm assuming the shell command would also fail from a terminal session.
The folder and file permissions are set to read/write so I can't figure out why the script is failing or develop a workaround.
Any advice would be greatly appreciated.
The script is as follows:
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 & "01010101.01"
do shell script "touch -t " & newDate & " " & quoted form of POSIX path of thisName
end repeat
end tell
When I run the script against one test file, I get the following:
Code Block error "Finder got an error: touch: /1953 front of house.jpg: Read-only file system" number 1
Apparently the shell script is failing because the file is considered read only. I haven't tried it but I'm assuming the shell command would also fail from a terminal session.
The folder and file permissions are set to read/write so I can't figure out why the script is failing or develop a workaround.
Any advice would be greatly appreciated.