#!/usr/bin/env bash # Adjust variables below to match your Immich setup datadir=${DATA_DIR:-/data} # datadir=/usr/src/app/upload immich_container=${IMMICH_CONTAINER:-immich_server} postgres_container=${POSTGRES_CONTAINER:-immich_postgres} postgres_user=${POSTGRES_USER:-postgres} postgres_db=${POSTGRES_DB:-immich} sql=$(cat <<'EOF' select 'db' as source, 'asset' as type, "originalPath", "fileSizeInByte", "createdAt", "deletedAt", status, visibility, id from asset left join asset_exif on "assetId" = "id" where not "isExternal" EOF ) find_cmd=$(cat < library.tsv # normal assets have both "fs" and "db" sources normal='^fs.*'$'\t'db$'\t' grep -v "$normal" library.tsv > library.mismatch.tsv echo "Files written: library.tsv library.mismatch.tsv Total assets/files: $(($(wc -l