Renaming Photos using ExifTool

ExifTool is a very cool tool that allows you to rename or even move images according to EXIF metadata.

Well I have decided to keep my pictures in the following folder format:

YYYY-MM_foldername

For example:

  • 2013-01_Family

  • 2012-07_Family

  • 2010-09_Family Flicks

  • 2014-02_Family Park Day Feb 2014

  • 2005-01_Farewell Dinner

There's a simple command to copy your photos into these new folders:

exiftool -d %Y-%m/%%f.%%e "-testname<CreateDate" *.jpg > testresults.txt 2>&1

Actually the above line will only do a test, it won't actually do the move. This way you can see what will happen first. To actually do the copy, change "-testname" to "-filename".

exiftool -d %Y-%m/%%f.%%e "-filename<CreateDate" *.jpg > testresults.txt 2>&1

But note that if there are any folders with photos taken on different months/years, these will be copied to other small folders. A single folder could be split up into multiple ones. It's important to identify any folders like this first before running the command.

Anyway more info is in the PDF (from http://www.sno.phy.queensu.ca/~phil/exiftool/filename.html).


exiftool -o -d %Y-%m_%%d/%%f.%%e "-testname<CreateDate" * > testresults.txt 2>&1

Whatsapp photos

Whatsapp removes the EXIF data but uses a format in the filename to define the date. To restore the EXIF date, there's a website that will do this:

https://www.batchifier.com/

Ensure that the zip file only contains jpg files and no folders.

Another method is to copy exiftool to the folder with all the WhatsApp photos, then run the following command in this folder (from command prompt):

exiftool "-datetimeoriginal<${filename;$_=substr($_,0,12)} 00:00" .

Make sure you include the "." at the end, as this specifies the current directory.

This method is mentioned here: https://exiftool.org/forum/index.php?topic=8456.0