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

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

exifmv

build Maintenance

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}

For example, if you have an image shot on Aug. 15 2020 named Foo1234.ARW it will e.g. end up in a folder hierarchy like so:

2020
├── 08
│   ├── 15
│   │   ├── foo1234.arw
│   │   ├── …

Safety

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-source it will remove the original.

In this case the original is permanently deleted!

Alternatively you can use the --trash-source which will move source files to the user's trash folder from where they can be restored to their original location on most operating systems.

Before doing any deletion or moving-to-trash exifmv checks that the file size matches. This is not the same as checking the files byte-by-byte. But due to almost all image file formats using some kind of compression matching size is a good enough indicator for files being identical for this application.

All that being said: I have been using this app since about seven years 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:
    exifmv [OPTIONS] <SOURCE> [DESTINATION]

ARGS:
    <SOURCE>         Where to search for images
    <DESTINATION>    Where to move the images (if omitted, images will be moved to current dir)
                     [default: .]

OPTIONS:
        --day-wrap <H[H][:M[M]]>    The time at which the date wraps to the next day [default: 0:0]
        --dry-run                   Do not move any files (forces --verbose)
    -h, --help                      Print help information
    -H, --halt-on-errors            Exit if any errors are encountered
    -l, --make-lowercase            Change filename & extension to lowercase
    -L, --dereference               Dereference symbolic links
    -r, --recurse-subdirs           Recurse subdirectories
        --remove-source             Delete any SOURCE file existing at DESTINATION and matching in
                                    size
        --trash-source              Move any SOURCE file existing at DESTINATION and matching in
                                    size to the system's trash
    -v, --verbose                   Babble a lot
    -V, --version                   Print version information

History

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!

Current version: 0.1.2

License

Apache-2.0 OR BSD-3-Clause OR MIT OR Zlib at your discretion.

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