Change photo file date based on EXIF data

I want to transfer some of my favourite photos from last year’s bike tour to my Android tablet. All my pictures are stored in Aperture on my Mac and although it’s a great piece of software it has a very annoying feature. When you export a version of a photo it sets the date and time of the file created to the current date/time rather than the EXIF date time. This is annoying because the Android Gallery app uses the file date time to order photos.

So I created a PowerShell script that reads the EXIF data then changes the file timestamps so they match when the photo was taken. And instead of having to write something from scratch I found a couple of useful functions online that I could combine to do exactly what I wanted.

The first two useful functions come from Juri Cincura. He’s written a script to rename files based on EXIF dates which is almost what I want, but not exactly. So I just used the bits that are useful.

The function to change the file properties comes from the Scripting Guys Blog. I modified it slightly to work on just a single file but it’s at least 80% their code.

If you are just getting started with PowerShell then this is a great way to learn. Find some scripts that do something similar to what you want then modify them. It saves you a bunch of time and effort!

This entry was posted in PowerShell, Scripting. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *