how can I copy the modification date of (media)files from the original files to the converted ones
Hi,
i have a little problem and I hope that maybe someone could help me out on that.
I have recently migrated my whole Windows photos library into Photos using PowerPhotos. Since there are some file types Photos cannot import I had to extract these files using the log files of the import. I have converted those to mp4.
But the converting files do not retain the modification date which Photos uses to sort the photos based on the dates. I dont want to go through each file one by one and change the date in Photos.
I could not find an app that would do something like batch-altering the metadata of files on macOS using other files metadata as a blueprint.
Because I am not a programmer I have tried to use ChatGTP to write Terminal/AppleScript-Codes but it does not seem to work out. The approach was to look up the modification dates of the unconverted files and overwriting the ones of the converted files. The names are exactly the same.
here is an example of a code ChatGPT came up with
set sourceFolderPath to "/Users/.../Downloads/AVIoriginal"
set destinationFolderPath to "/Users/.../Downloads/AVIconverted"
tell application "System Events"
set fileList to name of every file in folder sourceFolderPath
end tell
repeat with fileName in fileList
set sourceFilePath to sourceFolderPath & fileName
set destinationFilePath to destinationFolderPath & fileName
set modificationDate to modification date of (info for sourceFilePath)
set yearString to text -4 thru -1 of ("0000" & (year of modificationDate) as text)
set monthString to text -2 thru -1 of ("00" & (month of modificationDate) as text)
set dayString to text -2 thru -1 of ("00" & (day of modificationDate) as text)
set hourString to text -2 thru -1 of ("00" & (hours of modificationDate) as text)
set minuteString to text -2 thru -1 of ("00" & (minutes of modificationDate) as text)
do shell script "touch -t " & quoted form of (yearString & monthString & dayString & hourString & minuteString) & " " & quoted form of destinationFilePath
end repeat
I can manually type in the touch command for each file in terminal but this is also not a solution.
Maybe someone has a sparkling idea :D ?