Lightroom 4.1: Batch rename fails -- causes XMP files to be associated with wrong images

  • 1
  • Problem
  • Updated 8 years ago
  • (Edited)
Merged

This conversation has been merged. Please reference the main conversation: Lightroom 4: Mixed up Previews after renaming files

Batch rename in Lightroom renamed all files, but failed to update the referenced file (NEF) inside the XMP. This created a complete mess whereby all my settings were associated with the wrong files, and previews were overwritten with the wrong image data. What a mess!

Fortunately, I was able to write a script to write the correct names back into the XMP files, then I dumped the folder cache and reimported the photos. Thankfully this worked and I didn't lose all of the settings for all my photos!

This happened with Lightroom 4.1 on Windows 7/64.

--
Cheers,
Trevor
Photo of Trevor Morris

Trevor Morris

  • 22 Posts
  • 7 Reply Likes

Posted 8 years ago

  • 1
Photo of Steve Sprengel

Steve Sprengel, Champion

  • 2677 Posts
  • 349 Reply Likes
XMP files are associated with their RAW file because they have the same base-filename. The RawFileName tag within the XMP data is updated to whatever the filename is when you update the metadata within the XMP.

Are you seeing some problem when the name within the XMP is not the same as the renamed base-filename?
Photo of Trevor Morris

Trevor Morris

  • 22 Posts
  • 7 Reply Likes
Steve,

I wondered about that... regardless, after I did the batch rename, all NEF files started regenerating with the wrong image data. When I compared the incorrect thumbnails/previews to the actual raw files, I discovered that the thumbnails corresponded to the filenames in crs:RawFileName, rather than to the raw file with which the XMP file shared the same base name.

I suppose it's possible that dumping and regnerating the folder cache is what ultimately fixed the problem (rather than modifying the XMP files via script), but either way, there appears to be a serious issue here.

Thanks for your interest and assistance.
Photo of Steve Sprengel

Steve Sprengel, Champion

  • 2677 Posts
  • 349 Reply Likes
I think what you've discovered is that the LR rename does not rename or otherwise deal with the previews, only the raw and xmp files. And so rebuilding previews would have corrected things. The name embedded in the XMP file would have been corrected whenever LR next wrote more information to the XMP, which you could have done via a Save Metadata to Files command in the Library module.

Perhaps Adobe never considered someone renaming files to another name that also existed in the LR database/previews.
Photo of Trevor Morris

Trevor Morris

  • 22 Posts
  • 7 Reply Likes
So it sounds like there is indeed a bug here.

Also note that I have "Edit > Catalog Settings > Metadata > Automatically write changes into XMP" enabled, so I thought the changes would have been written to the XMP sidecar files when the rename took place...

Thanks again, Steve.
Photo of Steve Sprengel

Steve Sprengel, Champion

  • 2677 Posts
  • 349 Reply Likes
Automatically write changes into XMP is triggered when you change the metadata inside the XMP, not when you do a batch-rename which doesn't modify the metadata, only the filename.
Photo of Trevor Morris

Trevor Morris

  • 22 Posts
  • 7 Reply Likes
Of course. Thanks for the clarification. ;)
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 394 Reply Likes
Please a summary: How to avoid having this problem?...

Tnx,
R
Photo of Steve Sprengel

Steve Sprengel, Champion

  • 2677 Posts
  • 349 Reply Likes
The only problem is that the previews are matched to the wrong photos, so rebuilding the previews should fix the problem.
Photo of Trevor Morris

Trevor Morris

  • 22 Posts
  • 7 Reply Likes
Ran into this issue again:
1. Import photos
2. Edit photos (and delete "reject" photos)
3. Rename all photos beginning with 3000 to avoid conflicts
4. Rename all photos beginning from 1
5. Photos are now paired with the wrong 1:1 previews
6. Delete and rebuild 1:1 previews