Organizing a photo catalog using the command line

Renaming and organizing a large collection of photos can be a daunting task, but it can be simplified with the use of a powerful command-line tool called ExifTool. ExifTool is a free and open-source tool that can read, write and manipulate metadata in various file types, including many image and video formats. Here’s how you can use Exiftool to rename and organize your photos:

Install Exiftool Link to heading

If you don’t have Exiftool installed on your computer, you can download it from the official website. Installation instructions for Windows, Mac, and Linux can be found on the Exiftool website.

brew install exiftool

Use the “cd” command to navigate to the directory containing the photos you want to rename and organize.

Use Exiftool to rename and organize the files Link to heading

Exiftool can rename and organize your files based on their metadata. To do this, type the following command:

exiftool \
	-d %%e/%Y/%m/%d \
	"-directory<filemodifydate" \
	"-directory<createdate" \
	"-directory<datetimeoriginal" \
	-r your-photos-dir

This command renames and organizes all the photos in the current directory and its subdirectories based on their creation date. The new file path will be in the format of “file extension/year/month/day/filename”.

For example, a photo taken on January 1st, 2022, with the filename “IMG_0001.jpg” will be renamed and moved to the directory “jpg/2022/01/01/IMG_0001.jpg”. This will make it easier to locate and manage your photos.

Test and verify the changes Link to heading

Once you have renamed and organized the files, it is important to test and verify the changes. You can do this by opening a few photos to make sure they have been renamed and moved to the correct directory.