Created
October 10, 2025 19:08
-
-
Save thany/1f7a2172129aa4aea258c2971610581a to your computer and use it in GitHub Desktop.
Lightroom - Select all files with a corresponding stack ID
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
s.id_local AS stack_id, | |
CONCAT(rfl.absolutePath, fl.pathFromRoot) as path, | |
CONCAT(f.baseName, ".", f.extension) as filename | |
FROM AgLibraryFolderStackImage si | |
JOIN AgLibraryFolderStack s ON si.stack = s.id_local | |
JOIN Adobe_images ai ON si.image = ai.id_local | |
JOIN AgLibraryFile f ON ai.rootFile = f.id_local | |
JOIN AgLibraryFolder fl ON f.folder = fl.id_local | |
JOIN AgLibraryRootFolder rfl ON fl.rootFolder = rfl.id_local | |
ORDER BY s.id_local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You do this by opening the catalog as an SQLite database, and then execute this query. It will produce a table with columns
stack_id
,path
, andfilename
. You can then use this, for example, to create a script that does something with it.I used this to organise all stacked images into folders, each stack into its own folder. So I just took the resulting table, and used a code editor to transform it into
move
commands in a batch file. But you can do whatever you want with it.Disclaimer: make a backup of your catalog before attempting to open it with a SQLite tool of any kind. Although this will only ever read from your catalog, you can never be too careful if your catalog is worth anything to you.