#!/bin/bash

SRC_BASE="/mnt/convert/archives"
DEST_MANUAL="/mnt/5tb/archives/manuals"

echo "=== Missing-Date Archive Report ==="
echo "Scanning for .mp3 files with no recognizable date format..."
echo ""

# Match files that do NOT have YYYY-MM-DD or YYYYMMDD in their full name
find "$SRC_BASE" -type f -name '*.mp3' | while read -r file; do
    basename=$(basename "$file")

    # This line is now properly checking against the actual filename only
    if [[ ! "$basename" =~ [0-9]{4}-[0-9]{2}-[0-9]{2} && ! "$basename" =~ [0-9]{8} ]]; then
        echo "[NO DATE] $file"
    fi
done

echo ""
echo "Done. You may want to manually move these to:"
echo "  $DEST_MANUAL"
