0
\$\begingroup\$

I have a list of photo filenames that I uploaded to Flickr before I got Lightroom, in this format:

P2000518.jpg
P2000549.jpg
P2000577.jpg
[etc.]

and I wondered: is there a way to tell Lightroom to import such a list and use it as a collection? (I've already imported all of my photos to Lightroom)

Or do I have to add the photos to a collection manually? (I've done some heavy hacking to read data from the sqlite database of Lightroom, but I don't dare modify the database myself)

\$\endgroup\$

3 Answers 3

6
\$\begingroup\$

Yes, you can create a Smart Collection for these images. The process is no difficult but could take a little time to complete.

Lightroom's Smart Collections exported definitions are simple text files. They are not difficult to dissect and recreate at all. Based on your description I would create a Smart Collection in Lightroom with the selection being that the filename contains "p2000518.jpg" or "p2000549.jpg" after that you could export the Smart Collection settings and open the resulting .smcol file in a text editor. It will likely look like this:

s = {
    id = "15D46923-B382-4322-A3B9-19347EBF7080",
    internalName = "File Name Selection",
    title = "File Named",
    type = "LibrarySmartCollection",
    value = {
        {
            criteria = "filename",
            operation = "any",
            value = "p2000518.jpg",
            value2 = "",
        },
        {
            criteria = "filename",
            operation = "any",
            value = "p2000549.jpg",
            value2 = "",
        },
        combine = "union",
    },
    version = 0,
}

You can then continue the pattern using copy and paste or a mail merge in your word processing program. I also delete the ID number and when it reimports it worked file. I created 132 rules to do smart collections by month for the past decade and it worked no problem. Since you said you had already gone into the SQL database I figure this idea should make sense. If you need more information let me know and I can flush it out more.

\$\endgroup\$
6
  • \$\begingroup\$ Thanks! Worked like a charm!!! I use jsdb (jsdb.org) as my swiss-army-knife for computing, and I was able to write template lines to autogenerate the smart collection file. Then I imported it into Lightroom, and the photos appeared. Then I dragged them all into a regular collection. \$\endgroup\$
    – Jason S
    Commented Jan 2, 2011 at 23:19
  • \$\begingroup\$ I'm still curious as to why you needed to create a smart collection by hand, instead of just matching the beginning of the filename... \$\endgroup\$ Commented Jan 3, 2011 at 2:00
  • \$\begingroup\$ I made an assumption that you wanted to import the list, but yes you could write the rule to be starting with "XXXXX" or contains "XXXX" Glad it worked for you \$\endgroup\$ Commented Jan 7, 2011 at 17:52
  • \$\begingroup\$ Based on Bradford Benn's answer above, I created a tutorial in gist form, complete with Ruby script and a screencast. Hope it helps someone: gist.github.com/dergachev/6541450 \$\endgroup\$
    – Dergachev
    Commented Sep 12, 2013 at 18:11
  • \$\begingroup\$ Great answer! Really helped! Do you know if there is possibility to match files by full path? I mean - directory with filename? Eg. Pictures\2015\March\DSC0001.jpg. It would be helpful if I have same file names across directories. There is filter for directory and file name but seems there is no way to combine them together (for more than 1 photo). \$\endgroup\$
    – gumik
    Commented Jan 7, 2016 at 20:39
0
\$\begingroup\$

I'd probably import the pictures manually and then create a set from the 'Latest import'-collection. Less hacking means less risk of shrewing up :)

\$\endgroup\$
0
\$\begingroup\$

I'm not sure I understand. You say you want Lightroom to import a list, but you also say you already imported the photos?

Assuming you have imported all your photos in Lightroom, and what you are trying to do is create a collection of photos that all start with P2000 (followed by 3 digits and .jpg), did you try creating a simple smart collection? The first and only rule of that smart collection would be "Filename", the action "Starts with", and the parameter "P2000". Am I missing something?

Or if they have been just recently imported, you have all of them in the Catalog section in the left panel in Library Mode, under "Previous Import". Create another collection, say "Foo", right-click, select "Set as Target Collection", then go to "Previous Import", select all, right click and select "Add to Target Collection".

\$\endgroup\$
2
  • \$\begingroup\$ because I have 4000+ pictures so far in Lightroom and I want a particular set of 139 of them to be marked as being in a collection, where exact set of 139 matches the collection I uploaded to my flickr webpage before I started using Lightroom. \$\endgroup\$
    – Jason S
    Commented Jan 3, 2011 at 3:09
  • \$\begingroup\$ The ones I don't want put in that collection are not distinguishable from the ones that are by any other way than filename (or by me looking at the photos). \$\endgroup\$
    – Jason S
    Commented Jan 3, 2011 at 3:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.