Restore original filename to missing photos

  • Thread starter Thread starter hughjaas
  • Start date Start date
Status
Not open for further replies.
H

hughjaas

Guest
-I renamed photos in Lightroom 2.6
-The drive got corrupted and I lost everything, but I have backup catalog files as well as the original photos stored on another drive.
-The backup catalog wants to find the renamed files, but I only have the originals.
-I'm in the process of relinking these 1,''' missing images manually to their original filenames

is there a faster way to do this? The original filename shows up in the Metadata panel, but the 'Rename photo' menu is grayed out. Is there a command or plug-in to revert a group of pictures back to their original filenames? I searched and didn't find an answer here. I found a plug-in that will copy metadata fields, but it doesn't include Original Filename.

my first time on this forum - a ton of great info here! I will definitely come back and read more when I have more time.
 
Welcome to Lightroom Forums!

Do you still have access to the previews (CatalogNamePreviews.lrdata)? As I may have a solution if this is so.
 
[quote author=Denis Pagé link=topic=9'72.msg61118#msg61118 date=1264783578]
Welcome to Lightroom Forums!

Do you still have access to the previews (CatalogNamePreviews.lrdata)? As I may have a solution if this is so.
[/quote]

yes, I still have the file. Please help!
 
OK then. Keep those original files away for the moment and get prepared to restart from where we start here just in case. If you enabled "Autowrite to XMP" in the preferences, you can deactivate for now. Download LRViewer and use it to recover your images from the previews as if you had no backup of originals. The previews should be named as they are in the catalog. Put the recovered previews where the originals were; still as if that is the only thing you can recover. Now you should have no missing files even if they are now low resolution. As the files now exist on disk, you can now rename to original filename. You can now overwrite the temporary recovered previews with the originals from your backup and names should match.
 
The other option: Use the backup of the catalog preceding the renaming operation. But then you will lose what you did in between. Only you know...
 
very clever! I will give it a try later when I am back at the computer. I have a feeling I don't have the preview file though- I misunderstood. My whole system was wiped out (I was using a Crucial SSD with the bad firmware). I know I have the backup catalog file though which I have been using to manually link the files, but I don't think I backed up the preview file.

I'll post an update- thanks so much for your response!
 
If when you are in grid and wherever you go you see images in the thumbnails, this means that you properly recovered the previews.lrdata so the trick will work. Otherwise, if all boxes are gray, :(
 
I have the SQL to swap the original filename and current file name fields. If you're SQL savvy.....
 
And I should add, time and again I've asked Adobe to make the Find Missing Files intelligent enough to use the original filename field to find missing files....
 
[quote author=johnbeardy link=topic=9'72.msg61135#msg61135 date=1264791128]
I have the SQL to swap the original filename and current file name fields. If you're SQL savvy.....
[/quote]

Unfortunately the LRViewer method didn't work. The missing files don't have a preview at all.

I am SQL savvy. Can you PM me the query and any other pertinent info?

Hopefully version 3 will include a more intelligent search or a more flexible file renamer.

thanks everyone so far.
 
I'm not near the computer with the code today. In the meantime, look for SQLite Database Browser and make sure you've a backup of the database. It's pretty simple SQL once you know which table and fields need updating.
 
WOOHOO!!! back in business!
thanks so much for the guidance. you're right, it is pretty easy.
here's what I did in case someone else runs into the same problem (use at your own risk):

(for Mac):
-google "sqlite database browser mac" and download it. I used version 1.3 from mac.softpedia.com
-make a copy of your .lrcat file and store this somewhere very safe in case something goes wrong.
-launch sqlite database browser and open your working .lrcat file (not the one that has 'preview' in the name)
-select the 'Execute SQL' tab and copy and paste the following:

update AgLibraryFile set baseName= substr(originalFilename, 1, length(originalFilename)-4) where baseName != originalFilename

-if all goes well you should get a message that says 'no errors'
-save and close sqlite database browser and double-click your .lrcat file to launch Lightroom and get back to work!

that's it.

wow!

I spent about 4 hours trying to figure this out and could have manually linked all the files in that time, but this saved me thousands of mouse clicks and keystrokes.
 
Great. I'd recommend running an Optimise (it's SQL's Vacuum) and keeping that backup just in case. There are other fields which reference the filename, but I think they are updated dynamically (kinda) .

John
 
I ran an Optimize Catalog within Lightroom. I saw those other 2 fields that reference the changed names and they didn't revert back after I optimized. Not sure when and how they get updated but so far it hasn't been a problem.

was my SQL similar to yours?
 
I would update all columns which reflect the renamed filename, with an SQL similar to this:

Code:
update AgLibraryFile
  set BaseName    = substr(originalFilename,1,(length(originalFilename)-length(extension)-1)),
    idx_filename   = originalFilename,
    lc_idx_filename = lower(originalFilename)
  where ...............................

You don't want to possibly encounter errors in future LR releases, just because the changes you did years ago created inconsistent data which in the future might make a difference.

Also, please note that your where-clause selects all the rows in the table anyway, as the BaseName never matches the originalFilename (because of the extension). If you want the SQL to be restricted to renamed images, it would have to read

Code:
where BaseName <> substr(originalFilename,1,(length(originalFilename)-length(extension)-1))

Beat
 
great point. it's nice to know I can always go in and check and edit with ease now. I didn't think it was even possible.
 
Yes, the same, although I first ran it on a catalogue where every image needed updating. One time I did it, I also updated those other fields.

I'll add that I don't think one needs to do much of this SQL stuff with LR. It's only in exceptional circumstances, and only for those of us with SQL experience. This missing files problem really should not be one of those circumstances.
 
Status
Not open for further replies.
Back
Top