From 40979a9da56b90894368a14145d848f4b216a7e5 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Tue, 16 Jun 2026 21:27:29 +0000 Subject: [PATCH] feat(user/gthumb/rmall.org):Rename and upgrade mvall to rmall - Note: Now preserves some directory structure when moving to .trash --- user/gthumb/mvall.org | 48 ----------------------------- user/gthumb/rmall.org | 72 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 48 deletions(-) delete mode 100644 user/gthumb/mvall.org create mode 100644 user/gthumb/rmall.org diff --git a/user/gthumb/mvall.org b/user/gthumb/mvall.org deleted file mode 100644 index af4319b..0000000 --- a/user/gthumb/mvall.org +++ /dev/null @@ -1,48 +0,0 @@ -#+AUTHOR: Steven Baltakatei Sandoval -#+DATE: 2026-06-16 -#+TITLE: mvall -#+VERSION: 0.0.1 - -This command moves to trash a single selected file ~dir1/file123.ext~ -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 ~.trash~. - -Keyboard shortcut: ~Shift + T~ - -This is useful for pruning photos with multiple format extensions with -each extension type in a separate directory. For example, a ~JPG/~ -directory contains ~JPG/DSC01001.JPG~, ~JPG/DSC01001.JPG.ots~ and a -~ARW/~ directory contains ~ARW/DSC01001.ARW~. With ~JPG/DSC01001.JPG~ -selected and the ''rmall'' command executed within [[gThumb]], a ~.trash~ -directory is created next to ~JPG/~ and ~ARW/~. Then, the following -moves are performed: - -- ~JPG/DSC01001.JPG~ is moved to ~.trash/DSC01001.JPG~ -- ~JPG/DSC01001.JPG.ots~ is moved to ~.trash/DSC01001.JPG.ots~ -- ~ARW/DSC01001.ARW~ is moved to ~.trash/DSC01001.ARW~ - -Thus, by browsing ~JPG/~ in [[gThumb]] and performing *rmall* on undesired -photos, the unwanted related photos from not only ~JPG/~, ~ARW/~ and -other similar directories are prepared for disposal in ~.trash~. - -Line-by-line view: -#+BEGIN_EXAMPLE -# rmall v0.0.1 -dbf=/tmp/gtlog.txt; -f=%F; -fbase="$(basename "$f")"; -fne="$(printf "%s" "$fbase" | rev | cut -d'.' -f2- | rev; )"; -dppar="$(dirname %P)"; -dtrash="${dppar}/.trash"; -mkdir "$dtrash"; -printf "%s\n" "$dbf" "$f" "$fbase" "$fne" "$dppar" "$dtrash" 1>"$dbf" 2>&1; -mv -n -t "$dtrash" "${dppar}/"*"/${fne}".*; -sleep 1; -#+END_EXAMPLE - -Paste-ready view: -#+begin_example -dbf=/tmp/gtlog.txt; f=%F; fbase="$(basename "$f")"; fne="$(printf "%s" "$fbase" | rev | cut -d'.' -f2- | rev; )"; dppar="$(dirname %P)"; dtrash="${dppar}/.trash"; mkdir "$dtrash"; printf "%s\n" "$dbf" "$f" "$fbase" "$fne" "$dppar" "$dtrash" 1>"$dbf" 2>&1; mv -n -t "$dtrash" "${dppar}/"*"/${fne}".*; sleep 1; -#+end_example diff --git a/user/gthumb/rmall.org b/user/gthumb/rmall.org new file mode 100644 index 0000000..d5e8986 --- /dev/null +++ b/user/gthumb/rmall.org @@ -0,0 +1,72 @@ +#+AUTHOR: Steven Baltakatei Sandoval +#+DATE: 2026-06-16 +#+TITLE: rmall + +** Summary +This command moves to trash a single selected file ~dir1/file123.ext~ +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 ~.trash~; +parent directories (e.g. ~dir1~, ~dir2~) are preserved within +~.trash/~. + +** Stats +Version: 0.0.3 +gThumb version: ~3.12.6~ +Suggested keyboard shortcut: ~Shift + T~ + +** Usage +*rmall* 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, +~.trash~ directory is created next to ~JPG/~ and ~ARW/~. Then, the +following moves are performed: + +- ~JPG/DSC01001.JPG~ is moved to ~.trash/JPG/DSC01001.JPG~ +- ~JPG/DSC01001.JPG.ots~ is moved to ~.trash/JPG/DSC01001.JPG.ots~ +- ~ARW/DSC01001.ARW~ is moved to ~.trash/ARW/DSC01001.ARW~ + +Thus, by browsing ~JPG/~ in gThumb and performing *rmall* on undesired +photos, the unwanted related photos from not only ~JPG/~, ~ARW/~ and +other similar directories are prepared for disposal in ~.trash~. + +Then, it is upon the user to empty the contents of ~.trash~ to +permanently delete them. + +** Code +Line-by-line view: +#+BEGIN_EXAMPLE +# rmall v0.0.3 +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 + +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; +#+end_example -- 2.39.5