Restoring Original Filename

Started by victorengel, November 02, 2024, 08:17:10 PM

Previous topic - Next topic

victorengel

I don't believe Canon stores the original file name in EXIF. But I'd like to rename the files to the original filename if possible. So if it's not saved in EXIF, how do I imagine it be done? Well, I have standard previews of the files in Lightroom. The files were deleted but then restored from the formatted card, so now they have names chosen by the recovery tool.

So the idea is to create a listing of the files in Lightroom that includes some other data to uniquely identify the files. Then use that to get the filename to rename to.

For example, I have a file named "Canon EOS R5m2 8192x5464_000999.cr3" and I would like to rename it to IMG_12345.cr3 (or whatever it was).

Does such a scheme seem possible?

Phil Harvey

It is possible that the image number is stored somewhere in the file.  If so, the easiest thing would be if ExifTool could extract that.  If you upload a set of 7 consecutive original R5m2 CR3 files with their original names to some file sharing service, I'll take a look to see if I can find this.  Older EOS models stored a FileIndex and DirectoryIndex numbers that could be used to recover the original file name.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

victorengel

#2
Actually, I think the 000999 part must be from the original file name. That means I can rename them using Finder.

Edit: no - it must be sequential numbers. I've put a few that are sequential by those numbers here: https://www.dropbox.com/scl/fo/s3uyc65z2lvtne69x7928/AF-9dToqrBUjgi4OV1rKLTI?rlkey=1kgb3quhkjk8ssdzog0q9uie1&st=fsgaujb3&dl=0

Phil Harvey

I tried to be clear but I thought this might happen.  I need other files with the original names, not the ones renamed by the recovery tool.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

victorengel

I just exported some that were not deleted to match the restored ones and added them to that folder.
Quote from: Phil Harvey on November 02, 2024, 08:54:55 PMI tried to be clear but I thought this might happen.  I need other files with the original names, not the ones renamed by the recovery tool.

- Phil

There were some that were restored that I had. I added those with the original names to the link I gave previously. I should have done that before posting the link.

Phil Harvey

I did a thorough search but unfortunately couldn't find the file number in the metadata. :(

So it looks like we have to go with plan "B".  What information can you get in the listing from LightRoom?

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

victorengel

After I started this thread, I thought of an alternative, which will probably be easier and straightforward. Just rename them with sequential numbers starting at some given number, sorted by capture time.

Phil Harvey

This command will do that, starting with a number of 100 (for example):

exiftool -ext cr3 -filename=IMG_%100.5C.%e -fileorder createdate DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Martin B.

For what it's worth, I had tried to find the fileindex for the Canon R6 using a different technique and couldn't find it (CR3 fileindex and directoryindex not available).

I did find the shuttercount, and someone found it's also available for the R5 ( shuttercount on Canon EOS R5 may be in same location as EOS R6 ). Perhaps that can be used to rename the files.

bugmenot

If the file index isn't available, renaming by order or capture time is a good option. After renaming, you can organize the files easily.
https://discorduserinfo.pro/