+#+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