• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Renaming recovered files.

New Here ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

Hello!

Not too long ago I accidentally erased an external drive with 4TB of photos on it. Luckilly I was able to recover all of them. Unfortunately I was not able to recover their original filenames, and have not been able to merge them with my original lightroom catalogue that had all of the edits for each file.

The recovery software I used was able to pull the EXIF data, and name the file accordingly, e.g. "(2017-01-06 16-36-57)Canon Canon EOS 5D Mark III-5760x3840-3972227720.CR2".  I am loath to go through the entire library and rename files individually. I was wondering if there was a way to match the metadata information (camera, date, and time), and then rename the recovered file to the original filename that is stored in the Lightroom database, so I can then re-merge the file into the catalogue without losing the edits.

Thanks for your help!

TOPICS
SDK

Views

201

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

How about Restoring that drive from your Back Up copy of those images?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

Would this help?

LRC > Library > Rename then edit the Filename dropdown menu

revert.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 03, 2020 Dec 03, 2020

Copy link to clipboard

Copied

This issue comes up couple times a year.  The only solution I know of requires experience with command-line scripting:

 

1. Use the Any Filter plugin's Sort command (or Listview or LR/Transporter) to export a CSV file from the catalog containing three columns: the capture date/time, the camera model, and the file path recorded in the catalog.

 

2. Use Excel, Google Sheet, or a text editor with macro capabilities to transform the CSV file into a Windows batch file / Mac OS shell script containing lines of the form:

 

mv recovered-file path-recorded-in-catalog

 

I don't know what date/time your recovery software may have included in the recovered filenames -- it could be EXIF:DateTimeOriginal (capture date) or another of the many dates recorded in metadata.  So you'll have to experiment with that. 

 

[Use the blue reply button under the first post to ensure replies sort properly.]

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

@johnrellis 

So far I've been able to recover the files on a separate drive, and rename the files based on the capture time stamp and camera model from the EXIF tags. I then used a SQLite GUI to query the LrC database, and return a table with a compatible filename, original filename, and original path. 
Screen Shot 2020-12-06 at 7.15.15 PM.png

I then exported the results to a CSV file. Do you know of a way to create a shell script to rename the files to their original filename, create the necessary folders, and move the files into those folders? Is there a program out there that could automate it for me?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 06, 2020 Dec 06, 2020

Copy link to clipboard

Copied

When I've done similar tasks in the past, I open the CSV in Excel and add a final column to contain the appropriate shell command for each row. I use the Excel CONCATENATE function and other string functions to construct the shell commands. Then I copy that column into a text file in a text editor.

 

I don't know of any program that does this.

 

[Use the blue reply button under the first post to ensure replies sort properly.]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

@johnrellis 

Can you give me an example of a shell script that would be appropriate for my situation, or can you point me in the direction of where I can find how to write one? 

Thanks for your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 07, 2020 Dec 07, 2020

Copy link to clipboard

Copied

LATEST

@johnrellis 

I've found a shell script that works within an automator workflow in the apple community forum to rename the files:

https://discussions.apple.com/thread/250524625?page=1

I need to modify it now to include the third column, and move the file to the directory in the path, creating it if it doesn't exist. I'm not familiar with bash scripting. Can you help?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines