Photo Funnel: Drag-and-Drop Photo Copying Tool For Linux

Sometimes you need to transfer and organize just a handful of specific photos and raw files from your camera, and a simple GUI tool can help your with that. This tool is just a short Bash shell script uses the YAD tool to generate a drag-and-drop floating palette. When you drop files onto the palette and press the Execute button, the script copies the selected files to the specified directory and organizes them using the ExifTool-based commands.

photo-funnel

To deploy the latest version of YAD, you need to compile it from the source. This may sound like a daunting proposition, but it’s actually a rather straightforward process. First, install the required dependencies. On openSUSE Tumbleweed, this can be done using the following command:

sudo zypper in intltool gtk2-devel

Grab then the latest version of YAD from the project’s website, extract the downloaded archive, and switch to the resulting directory. Run then the following commands:

./configure — prefix=/usr
make
sudo make install

Use your preferred text editor to create a text file and paste the code below into it (replace the default $HOME/backup value with the actual path to the destination directory):

#!/usr/bin/env bash
dir='$HOME/backup'
f=$(yad --center --text-align=center --title="Photo Funnel" \
--button=gtk-close:0 --button=gtk-execute:0 --borders=15 \
--width=250 --height=150 \
--text='<big>\nDrop file(s) here.\nPress the <b>Execute</b> button.</big>' \
--dnd | sed 's/^.......//')
if [ ! -z "$f" ]; then
  if [ ! -d "$dir" ]; then
    mkdir "$dir"
  fi
  cp "$f" "$dir"
  cd "$dir"
  exiftool -d %Y%m%d-%H%M%S.%%e '-FileName<DateTimeOriginal' .
  exiftool '-Directory<CreateDate' -d ./%Y-%m-%d .
  yad --skip-taskbar --undecorated --borders=55 \
--timeout=3 --no-buttons --center \
--text="<big>Import completed. Bye!</big>"
else
  yad --skip-taskbar --undecorated --borders=75 \
--timeout=3 --no-buttons --center \
--text="<big>Nothing to do. Bye!</big>"
exit 1
fi

Save the file under the pf name and use the following commands to install the script and make it executable:

sudo cp pf /usr/local/bin/
sudo chown root:root /usr/local/bin/pf
sudo chmod 755 /usr/local/bin/pf

Once you’ve done that, press Alt+F2 and type pf. Drop then the desired photos and raw files onto the floating palette and press the Execute button. This should copy the files to the specified destination directory, rename them, and organize them into folders.

This is an excerpt from the Linux Photography book. Get your copy here.

Tech writer covering Linux and open source software

Tagged with: , ,
Posted in Photography, Software
2 comments on “Photo Funnel: Drag-and-Drop Photo Copying Tool For Linux
  1. Mark Brandis says:

    Hi!

    I tried the script and it didn’t work for me (Debian Testing). Probably /bin/sh is different. So I modified the script to work with bash. If you are interested, I can make it available to you. Please contact me via email.

    Cheers,
    Mark

Comments are closed.

Recipes for automated and streamlined photographic workflow on Linux

Practical advice for Tokyo nighttime photography

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

%d bloggers like this: