Changing File Date on Windows and Mac

Setting the wrong file date can get messy. There are times particularly for photos when we have to replace batteries on our digital cameras and having the camera reset the date and time to some default time in the past. Digital cameras typically do not come with a real time clock built into it and would hold charge enough between battery changes but if you do take the batteries out to charge overnight or to have them taken out because you would not use the camera for several weeks, you will find that the file date get reseted. So each time that happens, we will have to manually set the date and time all over again. That works fine for the most parts but I am not sure about you but I’ve face many times when I set the PM to AM or especially doing the start of the year, to have set the year on the camera to the year that has just past.

Having taken a load of pictures and realise that the dates and or time are wrong can be frustrating. For normal files, we can use the command line function built into Windows or Mac to change them to a single date and time but that is probably not something which we want for photos when not all photos are taken at the same time.

Changing File Date On Windows

We can evoke the command line powershell function such as

powershell $(get-item myphoto01.jpg).creationtime=$(get-date '05/25/2016 12:31')
powershell $(get-item myphoto01.jpg).lastaccesstime=$(get-date '05/25/2016 12:31')
powershell $(get-item myphoto01.jpg).lastwritetime=$(get-date '05/25/2016 12:31')

The first line would change the creation time and the last two relates to the last access and last write times to a specific file date and time. Windows uses the MM/DD/YYYY HH:MM format.

MM = Month
DD = Day
YYYY = Year
HH = Hour
MM = Minutes

The powershell has a more complex feature which allows you to add or subtract time from the existing date by using the AddYears, AddMonths, AddHours and AddMinutes function. This will let you do a sort of date maths to it. For instance, if you want to add a year and 4 days to your dates, you can do something like

powershell $(get-item myphoto01.jpg).creationtime=$((get-date).addyears(1).adddays(4))

To subtract 2 months from the file date, just do the following

powershell $(get-item myphoto01.jpg).creationtime=$((get-date).addmonths(-2))

All these are very powerful stuff. To do for more than a single file, you can probably create a batch file which will loop through all the files in that directory.

Changing File Date on the Mac

You will use the touch command such as

touch -t 201605251231 myphoto01.jpg
touch -mt 201605251231 myphoto01.jpg

On the Mac, the file date format used is YYYYMMHHMM . On the Mac and Linux system, the -t will change the file creation date and the -mt will do so for the modification and last access date. I have not found a way to do date maths on the existing file dates as yet.

So far all these does is change the file creation and modification dates but with photos particularly with cloud services such as Google Photos, it uses the EXIF Date and Time to sort the photos. To change the EXIF Dates, it is not possible using the default command line on either platforms. There is however, ExifTool which is a command line app which supports that.

To change all the creation, modification and exif dates, you do something like

exiftool -AllDates='2016:05:25 12:31:00' -overwrite_original myphoto01.jpg

Command lines being command lines can get pretty complicating and cumbersome as you need to have the syntax exactly as they are or else unexpected things may happen.

With that in mind and facing my own needs, both Batch JPEG Date Changer and CM Batch JPEG Date Changer were develop to provide a graphic interface based file date changer which is not only easy to use but provide you with all the features needed to change the EXIF, Creation and Modification Dates to a specific date and time or using the date maths features. Unlike the other tools, you do not need to change the entire date time but you can say change just the date portion and not the time. Because of the two step process, you will preview the dates and time to be applied before actually applying them to the photos.

Batch JPEG Date Changer helps change your file date on windows

Batch JPEG Date Changer (Windows)

CM Batch JPEG Date Changer - Helps change your file dates on the mac

CM Batch JPEG Date Changer (OS X)

Batch JPEG Date Changer is a Windows based application which will work with NTFS, FAT32 and exFAT file systems and CM Batch JPEG Date Changer is a Mac OS X app which will work with the HFS+, exFAT and FAT32 file systems.

We will explore how to change the dates in the next tutorial.