Effortless Photo Organizer

Go

A simple tool to organize your photos, videos, or other files by copying or hardlinking them into a date-based directory structure like $ROOT/year/month/day/.

TL;DR

I use a smartphone and Syncthing to automatically sync my photos to my PC. However, if I clean up my phone's memory, the synced photos on my PC are deleted as well. To avoid this, I needed a solution to back up and organize my photos without manual effort.

Dumping everything into one folder wasn't an option—finding anything later would be a nightmare. So, I built this tool in one evening to solve the problem. It has worked flawlessly for me and might help you too. If you encounter any issues, feel free to open a ticket—I'll do my best to assist.

Installation

Install the tool via go:

go install github.com/derfenix/photocatalog/v2@latest

Optionally, copy the binary to a directory in your system or user's $PATH (e.g., /usr/local/bin):

sudo cp ${GOPATH}/bin/photocatalog /usr/local/bin/photocatalog

Organization Modes

The tool supports the following organization modes:

  • copy — Copies files to the target directory. If the filesystem supports it, uses Copy-on-Write (COW) for efficiency.
  • hardlink — Creates hardlinks to the source files, saving disk space. Ideal if the source and target are on the same partition, though file permissions remain linked to the original.
  • move — Moves files from the source to the target directory.
  • symlink — Creates symbolic links at the target pointing to the source files.

Supported Formats

  • JPEG and TIFF files with valid EXIF metadata.
  • Files named in the format yyyymmdd_HHMMSS.ext (optionally with suffixes after the timestamp) (e.g., 20230101_123456.jpg). This format is common in Android cameras and other devices.

If a file lacks EXIF data, the tool falls back to parsing the filename.

Currently, the timestamp format is not customizable. Let me know if support for additional formats is required.

Usage

One-Time Run

Copy Files

photocatalog -mode copy -target ./photos/ -source ./sync/photos/
photocatalog -mode hardlink -target ./photos/ -source ./sync/photos/

Watch Mode

Enable continuous monitoring of a source directory:

Copy Files

photocatalog -mode copy -target ./photos -watch -source ./sync/photos/
photocatalog -mode hardlink -target ./photos/ -watch -source ./sync/photos/

Running as a Service

Systemd Setup

Install and configure the service:

sh ./init/install_service.sh systemd

This will:

  1. Install a systemd unit file.
  2. Create a configuration stub at $HOME/.config/photocatalog.
  3. Open the config file for editing.

Enable and start the service:

systemctl --user enable --now photocatalog

Now, files added to the monitored directory (MONITOR in the config) will automatically be organized into the target directory under the corresponding subdirectories.

FAQ

Why did you create this tool when awesome tool XXX already exists?

Two reasons:

  1. I wanted to.
  2. I could.
Description
Organize photos within date-aware directory structure
Readme MIT 253 KiB
Languages
Go 83.6%
Nix 14.3%
Shell 2.1%