How do I batch set the files "date modified" to the "date created"?

I have a folder with a bunch of photos taken by two different cameras, with one camera having been set to the wrong date. I managed to correct the EXIF date using Picasa (see photo.stackexchange), but apparently, it only adjusts the "Date Created" of the file, and not the "Date modified".

How can I make the "Date modified" (shown by default in the Finder) equal to the "Date Created" for a bunch of files?

I've looked in the touch terminal command, but couldn't find an answer there for my specific issue.


Solution 1:

Assuming JPG files:

for f in *.jpg; do
   olddate=$(stat -f %SB -t %Y%m%d%H%M "$f")
   touch -m -t $olddate "$f"    
done

For other suffixes just adjust the pattern in the for statement accordingly.