--- /dev/null
+#+AUTHOR: Steven Baltakatei Sandoval
+#+DATE: 2026-06-16
+#+TITLE: keep
+
+** Summary
+This command moves a single selected file ~dir1/file123.ext~ to be
+kept in a ~keep/~ directory along with any adjacent files that share
+the same stem located within the same directory
+(e.g. ~dir1/file123.*~). Also moved are matching files in directories
+neighboring the originalʼs parent directory (e.g. ~dir2/file123.*~).
+The destination trash directory is ~keep~; parent directories ~JPG/~
+and ~ARW/~ (e.g. ~dir1~, ~dir2~) are preserved within ~keep/~.
+
+** Stats
+Version: 0.0.1
+gThumb version: ~3.12.6~
+Suggested keyboard shortcut: ~Shift + T~
+
+** Usage
+*keep* is useful for pruning photos with multiple format extensions
+with each extension type in a separate directory. For example, letʼs
+say a ~JPG/~ directory contains ~JPG/DSC01001.JPG~,
+~JPG/DSC01001.JPG.ots~ and a ~ARW/~ directory contains
+~ARW/DSC01001.ARW~. With ~JPG/DSC01001.JPG~ selected in gThumb, a
+~keep~ directory is created next to ~JPG/~ and ~ARW/~. Then, the
+following moves are performed:
+
+- ~JPG/DSC01001.JPG~ is moved to ~keep/JPG/DSC01001.JPG~
+- ~JPG/DSC01001.JPG.ots~ is moved to ~keep/JPG/DSC01001.JPG.ots~
+- ~ARW/DSC01001.ARW~ is moved to ~keep/ARW/DSC01001.ARW~
+
+Thus, by browsing ~JPG/~ in gThumb and performing *keep* on defsired
+photos, related photos from not only ~JPG/~, ~ARW/~ and
+other similar directories are moved for preservation in ~keep/~.
+
+Then, it is upon the user to archive the contents of ~keep/~ to.
+
+** Code
+Line-by-line view:
+#+BEGIN_EXAMPLE
+# keep v0.0.1
+dbf=/tmp/gtlogkeep.txt;
+f="%F";
+fBase="$(basename "$f")";
+fne="${fBase%.*}";
+dppar="$(dirname %P)";
+dKeep="${dppar}/keep";
+dKeepJpg="${dKeep}/JPG/";
+dKeepArw="${dKeep}/ARW/";
+mkdir -p "$dKeep" "$dKeepJpg" "$dKeepArw";
+printf "%s\n" "$dbf" "$f" "$fBase" "$fne" "$dppar" "$dKeep" 1>"$dbf" 2>&1;
+mv -n -t "$dKeepJpg" "${dppar}/"*"/${fne}.JPG"*;
+mv -n -t "$dKeepArw" "${dppar}/"*"/${fne}.ARW"*;
+sleep 1;
+#+END_EXAMPLE
+
+Paste-ready view:
+#+begin_example
+dbf=/tmp/gtlogkeep.txt; f="%F"; fBase="$(basename "$f")"; fne="${fBase%.*}"; dppar="$(dirname %P)"; dKeep="${dppar}/keep"; dKeepJpg="${dKeep}/JPG/"; dKeepArw="${dKeep}/ARW/"; mkdir -p "$dKeep" "$dKeepJpg" "$dKeepArw"; printf "%s\n" "$dbf" "$f" "$fBase" "$fne" "$dppar" "$dKeep" 1>"$dbf" 2>&1; mv -n -t "$dKeepJpg" "${dppar}/"*"/${fne}.JPG"*; mv -n -t "$dKeepArw" "${dppar}/"*"/${fne}.ARW"*; sleep 1;
+#+end_example
~.trash/~.
** Stats
-Version: 0.0.3
+Version: 0.0.4
gThumb version: ~3.12.6~
Suggested keyboard shortcut: ~Shift + T~
with each extension type in a separate directory. For example, letʼs
say a ~JPG/~ directory contains ~JPG/DSC01001.JPG~,
~JPG/DSC01001.JPG.ots~ and a ~ARW/~ directory contains
-~ARW/DSC01001.ARW~. With ~JPG/DSC01001.JPG~ selected in gThumb,
+~ARW/DSC01001.ARW~. With ~JPG/DSC01001.JPG~ selected in gThumb, a
~.trash~ directory is created next to ~JPG/~ and ~ARW/~. Then, the
following moves are performed:
** Code
Line-by-line view:
#+BEGIN_EXAMPLE
-# rmall v0.0.3
+# rmall v0.0.4
dbf=/tmp/gtlog.txt;
f="%F";
-fbase="$(basename "$f")";
-fne="${fbase%.*}";
+fBase="$(basename "$f")";
+fne="${fBase%.*}";
dppar="$(dirname %P)";
dtrash="${dppar}/.trash";
-printf "%s\n" "$dbf" "$f" "$fbase" "$fne" "$dppar" "$dtrash" 1>"$dbf" 2>&1;
+printf "%s\n" "$dbf" "$f" "$fBase" "$fne" "$dppar" "$dtrash" 1>"$dbf" 2>&1;
for fsrc in "${dppar}/"*"/${fne}".*; do
if [ ! -e "$fsrc" ]; then continue; fi;
sdname="$(basename "$(dirname "$fsrc")")";
Paste-ready view:
#+begin_example
-dbf=/tmp/gtlog.txt; f="%F"; fbase="$(basename "$f")"; fne="${fbase%.*}"; dppar="$(dirname %P)"; dtrash="${dppar}/.trash"; printf "%s\n" "$dbf" "$f" "$fbase" "$fne" "$dppar" "$dtrash" 1>"$dbf" 2>&1; for fsrc in "${dppar}/"*"/${fne}".*; do if [ ! -e "$fsrc" ]; then continue; fi; sdname="$(basename "$(dirname "$fsrc")")"; ddest="${dtrash}/${sdname}"; printf "fsrc:%s\n" "$fsrc"; printf "sdname:%s\n" "$sdname"; printf "ddest:%s\n" "$ddest"; if [ ! -d "$ddest" ]; then printf "DEBUG:ddest does not exist:%s" "$ddest"; mkdir -p "$ddest"; else printf "DEBUG:ddest exists:%s" "$ddest"; fi; printf "STATUS: Moving %s → %s\n" "$fsrc" "$ddest/"; mv -n "$fsrc" "$ddest/"; done 1>>"$dbf" 2>&1; sleep 1;
+dbf=/tmp/gtlog.txt; f="%F"; fBase="$(basename "$f")"; fne="${fBase%.*}"; dppar="$(dirname %P)"; dtrash="${dppar}/.trash"; printf "%s\n" "$dbf" "$f" "$fBase" "$fne" "$dppar" "$dtrash" 1>"$dbf" 2>&1; for fsrc in "${dppar}/"*"/${fne}".*; do if [ ! -e "$fsrc" ]; then continue; fi; sdname="$(basename "$(dirname "$fsrc")")"; ddest="${dtrash}/${sdname}"; printf "fsrc:%s\n" "$fsrc"; printf "sdname:%s\n" "$sdname"; printf "ddest:%s\n" "$ddest"; if [ ! -d "$ddest" ]; then printf "DEBUG:ddest does not exist:%s" "$ddest"; mkdir -p "$ddest"; else printf "DEBUG:ddest exists:%s" "$ddest"; fi; printf "STATUS: Moving %s → %s\n" "$fsrc" "$ddest/"; mv -n "$fsrc" "$ddest/"; done 1>>"$dbf" 2>&1; sleep 1;
#+end_example