Skip to content

CLI to organize image files into a folder hierarchy based on EXIF data

Notifications You must be signed in to change notification settings

virtualritz/exifmv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exifmv

Rust

Moves images into a folder hierarchy based on EXIF tags.

Currently the hierarchy is hard-wired into the tool as this suits my needs. In the future this should be configured by a human-readable string supporting regular expressions etc.

For now the built-in string is this: {destination}/{year}/{month}/{day}/{filename}.{extension }

So if you have an image shot on Nov. 22. 2019 named Foo1234.ARW it will end up as this folder hierarchy: 2019/11/22/foo1234.arw.

Building

cargo build --release

Warning

With default settings exifmv uses move/rename only for organizing files . The only thing you risk is having files end up somewhere you didn’t intend.

But – if you specify the --remove-existing-source-files flag and it detects duplicates it will delete the original at the source. This is triggered by files at the destination matching in name and size.

In this case the original is removed!

However, you can use Rm ImProved by specifying the --use-rip flag. This requires aforementioned tool to be installed on your machine. When rip is used, files are moved to your graveyard/recycling bin instead of being permanently deleted right away.

All that being said: I have been using this app since about six months without loosing any images. As such I have quite a lot of empirical evidence that it doesn’t destroy data.

Still – writing some proper tests would likely give everyone else more confidence than my word. Until I find some time to do that: you have been warned.

Usage

USAGE:
    exivmv [FLAGS] [ARGS]

FLAGS:
    -c, --cleanup                         Remove empty directories (including hidden files)
    -L, --dereference                     Dereference symbolic links
    -H, --halt-on-errors                  Exit if any errors are encountered
    -h, --help                            Prints help information
    -l, --make-lowercase                  Change filename & extension to lowercase
    -r, --recurse-subdirs                 Recurse subdirectories
        --remove-existing-source-files    Remove any SOURCE file existing at DESTINATION and matching in size
        --use-rip                         Use external rip (Rm ImProved) utility to remove source files
    -V, --version                         Prints version information
    -v, --verbose                         Babble a lot

OPTIONS:
        --day-wrap <H[H][:M[M]]>    The time at which the date wraps to the next day (default: 00:00 aka midnight)

ARGS:
    <SOURCE>         Where to search for images
    <DESTINATION>    Where to move the images

Caveats For Developers

This is based on a Python script that did more or less the same thing and which served me well for 15 years. When I started to learn Rust in 2018 I decided to port the Python code to Rust as CLI app learning experience.

As such this app may not be the prettiest code you’ve come accross lately. It may also contain non-idiomatic (aka: non-Rust) ways of doing stuff. If you feel like fixing any of those or add some nice features, I look forward to merge your PRs. Beers!

About

CLI to organize image files into a folder hierarchy based on EXIF data

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages