main - code

photoname

about

photoname is a command-line utility for renaming/moving photo image files. The new folder location and naming are determined by the photo shoot date information contained within the file's EXIF tags.

photoname is written in Haskell. It's known to build under GHC 7.6.1 on systems where System.Posix (unix) packages are available.Bjorn Bringert's libexif binding library is required to build this software.

The path calculation scheme used here is admittedly specific to my needs. I welcome suggestions discussing, or patches allowing, more flexibility.

news

2012-11-01 (v3.0.1)
2011-05-08 (v3.0.0)
2010-01-25 (v2.3.0)
2009-06-07 (v2.2)
2009-04-18
2009-01-23
2008-10-11 (v2.1)
2008-03-20
Debian binary package of v2.0 available for AMD 64-bit thanks to generous packaging work from Magnus Therning
2008-03-05 (v2.0)
2007-09-14
Debian binary package of v003 now available for AMD 64-bit thanks to generous patch and packaging work from Magnus Therning
2007-09-13 (v003)
Repairs for a build problem with GHC > 6.6 specifically related to depending on FilePath instead of filepath and now requiring import of Data.Time.Format
2007-04-28 (v002)
Initial release

documentation

photoname's --help usage information:

Usage: photoname [OPTIONS] FILES
Rename and move photo files based on EXIF data

Options:
  -c FILE  --config=FILE     Defaults to ~/.config/photoname.conf. See CONFIG
  -C       --no-config       Do not load config file
  -D       --no-dirs         No subdirectory hierarchy. Just do DIR/NEWFILE
  -h       --help            This help text
           --move            Move the files, don't just hard-link to the new locations
  -n       --no-action       Display what would be done, but do nothing
  -o       --old-style       Use older name format with serial. See FILENAME FORMAT
  -p DIR   --parent-dir=DIR  Top-level directory where new links are created. Default: .
  -q       --quiet           Suppress normal output of what's being done
  -s SUF   --suffix=SUF      Add optional suffix to each name. See SUFFIX

This software is for renaming and storing your digital photos. It will
attempt to construct a meaningful filename based on the EXIF shoot date
in the file and optionally some other information.

CONFIG

The program will attempt to load a config file from this location:
~/.config/photoname.conf  A different path may be specified with the
--config switch
Entries in this file should be the long switches above minus the -- and
including any arguments they may have. To completely ignore an existing
config file, use the --no-config switch.

Example config contents:

   move
   old-style
   parent-dir=~/mypics
   suffix=_dwm


FILENAME FORMAT

Normal operation builds a subdirectory hierarchy consisting of directories
for the years, then subdirs within those for the day photos were
shot. These day dirs contain the image files, named as follows:

A photo shot on 2002-May-02 01:23:07 PM:
   img_1790.jpg -> <PARENTDIR>/2002/2002-05-02/20020502-132307.jpg

The EXIF date/time stamp used for naming is the first of these fields
to be found: DateTimeDigitized, DateTimeOriginal, DateTime

The <PARENTDIR> is the one given by the --parent-dir switch and
represents the top-level of where you're storing photos.

The --no-dirs switch will suppress the directory-hierarchy-creating part
of this, instead placing the new links directly in <PARENTDIR>. So
you get files like:

   <PARENTDIR>/20020502-132307.jpg

Default behavior is to create hard links to the new paths and leave the
original links as they were. You can use the --move switch to not leave
the original links.

The --old-style switch specifies the prior behavior of photoname where the
name is a date followed by the last three digits of the camera-assigned
number from the original filename:

   img_1790.jpg -> <PARENTDIR>/2002/2002-05-02/20020502_790.jpg

The code is basically looking for three digits before the file extension
to use as a 'serial' number for the day's photos. This is a seemingly
common occurrance with cameras that we can pick numbers off the end of
the filename. Examples of the two that I have:

                    vvv (use these digits)
   Panasonic:  P###0###.jpg
   Canon:      img_####.jpg
                    ^^^
                    ^^^

The --old-style behavior in photoname remains for backwards
compatibility. Many cameras today (and particularly camera phones)
don't generate a name we can use in this way, and so something needed
to change in this software.

Another nagging problem is the old-style naming is
non-deterministic. Using photoname --old-style on a file may not always
give you the same name, say if the serial info in the name is ever
lost. Naming based on the EXIF data alone is more reliable.


SUFFIX

The optional --suffix switch can be used to provide a string placed
between the date/time and extension. Use it for anything you like. An
example is photographer initials or series info. Example:

photoname invoked with --suffix=_dwm :
   20020502-132307_dwm.jpg

Version 3.0.0  Dino Morelli <dino@ui3.info>

getting it

older versions can be found in this directory



last modified 2012-11-01