]> zdv2.bktei.com Git - BK-2020-03.git/blob - user/gthumb/keep.org
f8140b693db678582151555b0cfb8fd816a4e9e7
[BK-2020-03.git] / user / gthumb / keep.org
1 #+AUTHOR: Steven Baltakatei Sandoval
2 #+DATE: 2026-06-16
3 #+TITLE: keep
4
5 ** Summary
6 This command moves a single selected file ~dir1/file123.ext~ to be
7 kept in a ~keep/~ directory along with any adjacent files that share
8 the same stem located within the same directory
9 (e.g. ~dir1/file123.*~). Also moved are matching files in directories
10 neighboring the originalʼs parent directory (e.g. ~dir2/file123.*~).
11 The destination trash directory is ~keep~; parent directories ~JPG/~
12 and ~ARW/~ (e.g. ~dir1~, ~dir2~) are preserved within ~keep/~.
13
14 ** Stats
15 Version: 0.0.1
16 gThumb version: ~3.12.6~
17 Suggested keyboard shortcut: ~Shift + T~
18
19 ** Usage
20 *keep* is useful for pruning photos with multiple format extensions
21 with each extension type in a separate directory. For example, letʼs
22 say a ~JPG/~ directory contains ~JPG/DSC01001.JPG~,
23 ~JPG/DSC01001.JPG.ots~ and a ~ARW/~ directory contains
24 ~ARW/DSC01001.ARW~. With ~JPG/DSC01001.JPG~ selected in gThumb, a
25 ~keep~ directory is created next to ~JPG/~ and ~ARW/~. Then, the
26 following moves are performed:
27
28 - ~JPG/DSC01001.JPG~ is moved to ~keep/JPG/DSC01001.JPG~
29 - ~JPG/DSC01001.JPG.ots~ is moved to ~keep/JPG/DSC01001.JPG.ots~
30 - ~ARW/DSC01001.ARW~ is moved to ~keep/ARW/DSC01001.ARW~
31
32 Thus, by browsing ~JPG/~ in gThumb and performing *keep* on defsired
33 photos, related photos from not only ~JPG/~, ~ARW/~ and
34 other similar directories are moved for preservation in ~keep/~.
35
36 Then, it is upon the user to archive the contents of ~keep/~ to.
37
38 ** Code
39 Line-by-line view:
40 #+BEGIN_EXAMPLE
41 # keep v0.0.1
42 dbf=/tmp/gtlogkeep.txt;
43 f="%F";
44 fBase="$(basename "$f")";
45 fne="${fBase%.*}";
46 dppar="$(dirname %P)";
47 dKeep="${dppar}/keep";
48 dKeepJpg="${dKeep}/JPG/";
49 dKeepArw="${dKeep}/ARW/";
50 mkdir -p "$dKeep" "$dKeepJpg" "$dKeepArw";
51 printf "%s\n" "$dbf" "$f" "$fBase" "$fne" "$dppar" "$dKeep" 1>"$dbf" 2>&1;
52 mv -n -t "$dKeepJpg" "${dppar}/"*"/${fne}.JPG"*;
53 mv -n -t "$dKeepArw" "${dppar}/"*"/${fne}.ARW"*;
54 sleep 1;
55 #+END_EXAMPLE
56
57 Paste-ready view:
58 #+begin_example
59 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;
60 #+end_example