]> zdv2.bktei.com Git - BK-2020-03.git/commitdiff
feat(user/gthumb/keep.org):Add command to preserve selected files
authorSteven Baltakatei Sandoval <baltakatei@gmail.com>
Tue, 16 Jun 2026 21:38:12 +0000 (21:38 +0000)
committerSteven Baltakatei Sandoval <baltakatei@gmail.com>
Tue, 16 Jun 2026 21:38:12 +0000 (21:38 +0000)
user/gthumb/keep.org [new file with mode: 0644]
user/gthumb/rmall.org

diff --git a/user/gthumb/keep.org b/user/gthumb/keep.org
new file mode 100644 (file)
index 0000000..f8140b6
--- /dev/null
@@ -0,0 +1,60 @@
+#+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
index d5e8986f3ca8bf7b8c6617e647cee58f76f31c41..c973e261d5fd420532853a3526933a0607a86c2d 100644 (file)
@@ -12,7 +12,7 @@ parent directories (e.g. ~dir1~, ~dir2~) are preserved within
 ~.trash/~.
 
 ** Stats
-Version: 0.0.3
+Version: 0.0.4
 gThumb version: ~3.12.6~
 Suggested keyboard shortcut: ~Shift + T~
 
@@ -21,7 +21,7 @@ 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:
 
@@ -39,14 +39,14 @@ permanently delete them.
 ** 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")")";
@@ -68,5 +68,5 @@ sleep 1;
 
 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