Download and Organize Photos with Fotobasher

Need to quickly off-load photos from your camera and neatly organize them into folders by date? The Fotobasher shell script cobbled together by yours truly can help you with that.

The script copies photos from a mounted storage device like an SD card to the TMP directory, organizes the photos into folders by date, and then renames each photo using the data pulled from the photo’s metadata. Photos are renamed using the YYYYMMDD-HHMMSS-ShutterCount.EXT format, so the resulting file name looks something like this: 19730115-135547-3375.NEF. Fotobasher is configured to work with Nikon D90, but adapting the script to other camera models requires only a few simple tweaks.

If you have Git installed on your machine, you can clone the Fotobasher Git repository using the following command:

git clone git://github.com/dmpop/fotobasher.git

Alternatively, you can download the latest release of Fotobasher from the project’s download page.

To make Fotobasher work on your machine, you need to do some preparatory work. Start with installing the ExifTool utility which the script uses to extract relevant metadata, arrange photos, and rename them. ExifTool is available in the software repositories of many mainstream Linux distributions, so you can install it using your distro’s package manager. On Debian and Ubuntu, you can do this by executing the following command:

sudo apt-get install libimage-exiftool-perl

Next, make the fotobasher.sh script executable using the following command:

chmod +x fotobasher.sh

Rename then the ExifTool_config file to .ExifTool_config and move it to your home directory:

cp fotobasher/ExifTool_config ~/.ExifTool_config

Adding the .ExifTool_config file is required only if you want to include the shutter count value in the file names. In case you use another renaming rule, you can skip this step.

Finally, open the script in a text editor and specify the desired TARGET_DIR value and the correct file format (e.g., RAW, CR2, or JPG).

That’s all there is to it. Insert the card with photos, run the script to download the photos, arrange them into folders, and rename them.