How can I export a text list of filenames from a Lightroom collection in collection order?
Asked 6/27/2015
7 views
2 answers
0
I use Lightroom to organize photos and need a plain text file listing the images in a specific collection for use in my website workflow. I only need each item's filename (and ideally copy name if available), not the full path, and the list should follow the same order as the collection. Is there a way to get this from Lightroom, with or without a plugin?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
11y ago
2 Answers
5
You might be able to exploit the fact that a LR catalog is actually a SQLite database. I've written ruby scripts in the past to generate statistics on my photos. The sort of data you're after probably isn't much more difficult to produce.
Mac OS ships with the sqlite command line tools. If command line interfaces aren't your thing, there are several different SQLite GUIs in the Mac App Store.
See this for a (older, but still valid) quick intro to pulling the data.
Edit
I cracked open my LR CC catalog and mocked up a quick test of my theory. I ended up with the following query:
SELECT lf.idx_filename
FROM AgLibraryCollection AS c,
AgLibraryCollectionImage AS ci,
Adobe_images AS i,
AgLibraryFile AS lf
WHERE c.id_local = ci.collection
AND i.id_local = ci.image
AND lf.id_local = i.rootFile
AND c.name = 'Collection Name'
The easiest way to execute this is to install SQLite Free - Datum from the Mac App store, open your Lightroom catalog (make sure LR is closed) and stick the query in the SQL tab. A more complex (but easier to repeat) method would be to stick the query in a text file, and run the following in Terminal:
sqlite3 /path/to/lightroom_catalog.lrcat < query.txt
Originally by user5068. Source · Licensed CC BY-SA 4.0
user5068
11y ago
0
Generated from our catalog & community — verify before relying on it.
Yes. A practical way is to read the Lightroom catalog directly, since the catalog is a SQLite database. Community answers note that you can query the collection tables and return filenames for the images in a named collection. This avoids needing an export plugin and can produce plain text or XML after post-processing.
Example approach: use SQLite tools (command line or a GUI) on the Lightroom catalog and query the collection/image/file tables to return idx_filename for a given collection name. If needed, you can also join the folder/root-folder tables to get full paths, then strip the path and keep only the filename.
A Mac-only workaround mentioned was dragging selected photos from Lightroom into TextEdit to get paths as text, then removing the path portion with search/replace or a regex. However, a later note says newer macOS/TextEdit versions may paste the images themselves instead of the paths, so this is less reliable.
If collection order matters, prefer the catalog/SQLite method, since it works directly from Lightroom’s stored collection data.
Recommended products
UniqueBot
AI11y ago
Your Answer
Related Questions
Can Lightroom export filenames use an image’s position in a collection?
Can Lightroom watermark exports with the image filename and virtual copy name?
Can Lightroom preserve custom collection order when exporting or publishing incremental album updates?
Can Lightroom 4 automatically add a virtual copy to the same collection as the original?
How can I name Lightroom exports so PhotoShelter sorts by rating descending and time ascending?