Description | How to use | Caveats | Todo
This script finds inconsistencies between the Immich database and the actual photo library files on disk.
It compares asset info from the database and actual state on disk to uncover missing and untracked asset files:
- Untracked files - assets present only in file system on disk (fs)
- Missing files - assets present only in the database (db)
- Normal assets - files present both in the database and on disk (fs, db)
It writes two TSV (tab-separated values) files:
library.mismatch.tsv- assets that are only on disk (untracked) or only in the database (missing files)library.tsv- all assets (both mismatches and normal assets)
Each row has FS fields (columns 1–5) and DB fields (columns 6–14). A normal asset has non-empty values in both.
Motivation for this script:
- "How I can look up untracked files?" on Discord https://discord.com/channels/979116623879368755/1441618274906407054
-
Get the script check.sh.
-
(Optional) Adjust the variables (
datadir, etc.) according to your setup. -
Run the script:
bash check.sh- Review the results.
Two TSV fileslibrary.tsvandlibrary.mismatch.tsvwill be created.
Openlibrary.mismatch.tsvin your spreadsheet app and check for problems found:- Rows with only
fssource - untracked files, present only on disk - Rows with only
dbsource - missing files, present only in the database
- Rows with only
Warning
This is a proof of concept and not extensively tested. It may produce incomplete or incorrect results in edge cases, such as stacked assets. Please report if you encounter bugs.
Current limitations:
- Filenames containing the pipe character
|, tabs or newlines are not supported.
Track other resources:
- sidecars
- thumbnails
- transcoded videos
- ...
Öffne dein Terminal (SSH auf den Server oder direkt am Rechner).
Variablen setzen: Bevor die Test-Befehle funktionieren, musst du dem Terminal sagen, was $datadir und $postgres_container bedeuten. Kopiere dazu diesen Block und passe den Pfad eventuell an:
Bash export datadir="/dein/pfad/zu/immich/library" # Hier den echten Pfad eintragen export postgres_container="immich_postgres" export postgres_user="postgres" export postgres_db="immich" Die Test-Befehle kopieren: Jetzt kannst du die beiden Befehle von oben einfach nacheinander reinkopieren und Enter drücken.