Number of images/videos does not match

In the Administration - Server Status section it shows shows 19301 photos and 504 videos (= 19805) for that user. When I run a find on the library I get 19974 files (images and videos).
$ find /l/immich/library/me/ -type f | wc -l
19974
$ find /l/immich/library/me/ -type f | wc -l
19974
Then I checked the database and found 19975 entries. (And indeed, one of the assets does not have a matching file on the file system) ```docker-compose exec -u postgres database psql immich -P tuples_only -c 'SELECT "ownerId","originalPath" FROM assets WHERE "ownerId" = '"'5c511457-c 05f-4a36-bbf7-4f33f0913473';" | grep /library/ | wc -l 19975
2 Replies
Alex Tran
Alex Tran2y ago
It could be xml file perhaps?
scrufola
scrufolaOP2y ago
The file in the assets db but missing in the library is a jpg. And the library directory only contains images and videos, no xml.
docker-compose exec -u postgres database psql immich -P tuples_only -c 'SELECT "originalPath" FROM assets WHERE "ownerId" = '"'5c511457-c05f-4a36-bbf7-4f33f0913473';" | sed -e 's,^ upload/,,' | sort > /tmp/files_from_db.txt

find /l/immich/library/me -type f | sed -e 's,/l/immich/,,' | sort > /tmp/files_from_dir.txt


$ diff -u /tmp/files_from_db.txt /tmp/files_from_dir.txt
--- /tmp/files_from_db.txt
+++ /tmp/files_from_dir.txt
@@ -1,4 +1,3 @@
-
library/me/2007/2007-01-24/IMG_1733.JPG
library/me/2007/2007-01-24/brian.IMG_1734.JPG
library/me/2007/2007-01-24/brian.IMG_1736.JPG
@@ -17513,7 +17512,6 @@
library/me/2021/2021-06-18/IMG_20210618_181324.jpg
library/me/2021/2021-06-18/IMG_20210618_181330.jpg
library/me/2021/2021-06-18/IMG_20210618_181402.jpg
-library/me/2021/2021-06-18/IMG_20210618_181406.jpg
library/me/2021/2021-06-18/IMG_20210618_181412.jpg
library/me/2021/2021-06-18/IMG_20210618_181416.jpg
library/me/2021/2021-06-18/IMG_20210618_181426.jpg



$ find /l/immich/library/me -type f | sed -e 's,.*\.,,' | tr '[A-Z]' '[a-z]' | sort | uniq -c
8 3gp
19300 jpg
2 mov
614 mp4
49 mpg
1 mts
docker-compose exec -u postgres database psql immich -P tuples_only -c 'SELECT "originalPath" FROM assets WHERE "ownerId" = '"'5c511457-c05f-4a36-bbf7-4f33f0913473';" | sed -e 's,^ upload/,,' | sort > /tmp/files_from_db.txt

find /l/immich/library/me -type f | sed -e 's,/l/immich/,,' | sort > /tmp/files_from_dir.txt


$ diff -u /tmp/files_from_db.txt /tmp/files_from_dir.txt
--- /tmp/files_from_db.txt
+++ /tmp/files_from_dir.txt
@@ -1,4 +1,3 @@
-
library/me/2007/2007-01-24/IMG_1733.JPG
library/me/2007/2007-01-24/brian.IMG_1734.JPG
library/me/2007/2007-01-24/brian.IMG_1736.JPG
@@ -17513,7 +17512,6 @@
library/me/2021/2021-06-18/IMG_20210618_181324.jpg
library/me/2021/2021-06-18/IMG_20210618_181330.jpg
library/me/2021/2021-06-18/IMG_20210618_181402.jpg
-library/me/2021/2021-06-18/IMG_20210618_181406.jpg
library/me/2021/2021-06-18/IMG_20210618_181412.jpg
library/me/2021/2021-06-18/IMG_20210618_181416.jpg
library/me/2021/2021-06-18/IMG_20210618_181426.jpg



$ find /l/immich/library/me -type f | sed -e 's,.*\.,,' | tr '[A-Z]' '[a-z]' | sort | uniq -c
8 3gp
19300 jpg
2 mov
614 mp4
49 mpg
1 mts

Did you find this page helpful?