Skip to content

Check for untracked or missing files in Immich library

Notifications You must be signed in to change notification settings

FollowTheWizard/immich-library-check

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Immich library consistency check

Description | How to use | Caveats | Todo

Description

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 to use

  1. Get the script check.sh.

  2. (Optional) Adjust the variables (datadir, etc.) according to your setup.

  3. Run the script:

bash check.sh
  1. Review the results.
    Two TSV files library.tsv and library.mismatch.tsv will be created.
    Open library.mismatch.tsv in your spreadsheet app and check for problems found:
    • Rows with only fs source - untracked files, present only on disk
    • Rows with only db source - missing files, present only in the database

Caveats

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.

Todo

Track other resources:

  • sidecars
  • thumbnails
  • transcoded videos
  • ...

Schritt-für-Schritt Anleitung

Ö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.

About

Check for untracked or missing files in Immich library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%