#+AUTHOR: Steven Baltakatei Sandoval
-#+DATE: 2026-08-01
+#+DATE: 2026-08-02
#+TITLE: gThumb prune
** Summary
The method centers around a Bash script named ~gthumb-prune.sh~ which
may be bound to a gThumb keyboard shortcut to quickly move selected
image files to a desired location. The Bash script is run by a short
-shell script specified in gThumbʼs 🔧 → Personalize… menu.
+shell script specified in gThumbʼs 🔧 → Personalize… menu.
Additionally, sidecar files as well as associated files sharing the
same file name stem (i.e. ~../*/DSC00001.*~) are also grouped and
moved to the desired location.
├── DSC00001.JPG.ots
├── DSC00002.JPG
├── DSC00002.JPG.ots
- ├── DSC00002.JPG
- └── DSC00002.JPG.ots
+ ├── DSC00003.JPG
+ └── DSC00003.JPG.ots
#+end_example
Let us say gThumb has the ~JPG~ directory open and we have selected
Now, with ~DSC00002.JPG~ selected, press ~Shift+K~ on your
keyboard. The image should disappear from view and a new directory
-should appear in the the left navbar, reflecting a new directory structure.
+should appear in the left navbar, reflecting a new directory structure.
#+begin_example
.
└── DSC00002.JPG.ots
#+end_example
-The ~DSC0002.*~ files (4 in total) have been moved to now reside
+The ~DSC00002.*~ files (4 in total) have been moved to now reside
within a ~keep~ directory with their ~JPG~ and ~ARW~ subdirectory
structure preserved. Thus, the ~./JPG/~ and ~./ARW/~ directories have
been pruned.
├── DSC00001.JPG.ots
├── DSC00003.JPG
└── DSC00003.JPG.ots
-#+end_Example
+#+end_example
So, the contents of ~./JPG/~ may be pruned by selecting files you want
to keep and pressing ~Shift+K~ and by selecting files you want to
deleting the undesired files, delete the contents of ~.trash~ via the
terminal command:
-: $ rm -r ./.trash/*
+: $ rm -r ./.trash
** Code
gthumb-prune.sh:
-#+begin_code
+#+begin_src bash
#!/bin/bash
# Desc: Prunes files selected by gThumb.
# Note: Moves files into a directory with a specified name.
-# Usage: gthumb-prune.sh [STR dirname] [FILES…]
+# Usage: gthumb-prune.sh DIRNAME FILES…
# Example: $HOME/.local/bin/gthumb-prune.sh keep %F
# If '%F' expanded to `~/Pics/MyJPGs/DSC00001.JPG`, then
# "$HOME/Pics/*/DSC00001.*" files are moved to:
# Author: Steven Baltakatei Sandoval
# License: GPLv3+
-#+end_code
-
+#+end_src