first commit

This commit is contained in:
2025-10-09 10:55:52 +02:00
commit 6be8201511
20 changed files with 2132 additions and 0 deletions

42
clean_nfo.sh Executable file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euo pipefail
DRYRUN=false
DIR="."
# Argumenthantering
for arg in "$@"; do
case "$arg" in
--dry-run) DRYRUN=true ;;
*) DIR="$arg" ;;
esac
done
# Kontroll att katalogen finns
if [ ! -d "$DIR" ]; then
echo "Fel: katalogen '$DIR' finns inte"
exit 1
fi
echo "Söker efter .nfo-filer i: $DIR"
$DRYRUN && echo ">>> DRY-RUN: inga filer tas bort <<<"
# Gå igenom alla .nfo-filer
find "$DIR" -type f -iname '*.nfo' -print0 |
while IFS= read -r -d '' nfo; do
base="${nfo%.*}"
# Matcha motsvarande .mp4 (case-insensitive)
shopt -s nullglob nocaseglob
mp4s=( "$base".mp4 )
shopt -u nocaseglob
if (( ${#mp4s[@]} == 0 )); then
if $DRYRUN; then
echo "[dry-run] would delete: $nfo"
else
echo "Deleting: $nfo"
rm -v -- "$nfo"
fi
fi
done