dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit a293cf7dac5b9a45121be5a9f93b26c8c25a0dbd
parent 2f38c17a921520841e90f9f728ddea37b1b322de
Author: hhvn <dev@hhvn.uk>
Date:   Thu, 15 Jul 2021 21:52:56 +0100

.s/b/imgclean: symlink clean/basename(original file) to cleaned img

Diffstat:
M.scripts/bin/imgclean | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/.scripts/bin/imgclean b/.scripts/bin/imgclean @@ -21,6 +21,7 @@ do # sum name of file, for speed, # as opposed to the file itself sum=$(basename "$f" | $summer | awk '{print $1}') + nhash=$(basename "$f" | sed 's/\..*//') # ignore already created [ ! -f "$odir/$sum".jpg ] && { @@ -28,4 +29,13 @@ do exiftool "$f" -all= -o "$odir/$sum".jpg >/dev/null printf 'done\n' } || printf "%s already exists, ignoring %s...\n" "$odir/$sum.jpg" "$f" + [ ! -f "$oder/$nhash".jpg ] && { + printf 'symlinking %s <-> %s...' "$odir/$sum.jpg" "$odir/$nhash.jpg" + # symlinks are relative to the directory the symlink is in, + # therefore - do not use $odir/$sum.jpg. ln is kinda dumb in + # this regard, it just uses the raw argv contents, no checking or + # resolving of files. Perhaps a smart ln could be a project? + ln -s "$sum.jpg" "$odir/$nhash.jpg" + printf 'done\n' + } done