bin: deduplication with rmlint and download handling

This commit is contained in:
xeruf 2023-11-04 19:10:15 +01:00
parent 863ef2051b
commit 289c583fbe
4 changed files with 32 additions and 4 deletions

5
.local/bin/scripts/dedup Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh -e
rmlint --max-depth=5 --keep-hardlinked --rank-by=HpOdlam -o pretty -o sh:/tmp/dedup.sh "$@"
printf "Enter to confirm, any text to skip (answer does not matter if nothing was printed above this line) "
read -r answer
test -n "$answer" || /tmp/dedup.sh -d

6
.local/bin/scripts/dedup-dox Executable file
View File

@ -0,0 +1,6 @@
#!/bin/zsh
# Deduplicate Documents
dox=$(realpath $DATA/3-*)
echo "Hardlinking:"
dedup --max-depth=9 -c sh:handler=hardlink "$dox" "$@"
dedup --max-depth=9 "$dox" "$@"

View File

@ -0,0 +1,5 @@
#!/bin/zsh
# Deduplicate Images
img=$(realpath $DATA/4-*/images)
#find -type f -not -name '*.xmp' | rmlint -k - // pictorials
dedup --max-depth=9 -k $img $img/[a-z]*/ // $img/pictorials/stockicons/ $img/**/*.xmp "$@"

View File

@ -1,8 +1,20 @@
#!/bin/sh -e
#!/bin/sh
# Move common files into their place from the downloads folder.
dow=$DATA/5-*/download
rmlint --rank-by=l -o pretty -o sh:/tmp/dow.sh *.*
printf "Enter to confirm, any text to skip. "
d5=$DATA/5-*
dow=$d5/download
# Internal Duplicates
rmlint --rank-by=Olam -o pretty -o sh:/tmp/dow.sh $dow/*.*
printf "Enter to confirm, any text to skip (answer does not matter if nothing is printed above this). "
read -r answer
test -n "$answer" || /tmp/dow.sh -d
# Songs
mv -v -- $dow/*.mp3 $dow/*.flac $dow/*.wav $MUSIC/
mv -v -- $dow/*.iso $DATA/4-*/flash/
# Data-dir duplicates
rmlint --keep-all-tagged --max-depth=5 --rank-by=Odlam -o pretty -o sh:/tmp/dow.sh $d5 // $DATA/1-* $DATA/2-* $DATA/3-* $DATA/4-*
printf "Enter to confirm, any text to skip (answer does not matter if nothing is printed above this). "
read -r answer
test -n "$answer" || /tmp/dow.sh -d