Skip to main content
toklas
Inspiring
November 15, 2022
Answered

How to rename files and write old filename into IPTC oder EXIF data

  • November 15, 2022
  • 5 replies
  • 3341 views

hallo everybody!

i need to rename my files with a consecutive number, but i need to keep the old filename too. the archive software i export to is "augias" and it can read iptc or exif data. so i was wondering if there is a way to write the old filename into an iptc or exif field. with lighroom or if necessary some other software.

to be more specific about my filenames:

out of the camera the filenames have these names:
asdf_0651, asdf_0652 and so on

when i import to lightroom, i rename them to 20221101asdf117, 20221101asdf118 and so on

 

after that i choose some files to export them to the archive, and they need to be renamed with a consecutive number like this:


20221101asdf117 ----> 1
20221101asdf121 ----> 2
20221101asdf176 ----> 3

so the filename i want to write into the metadata is not the "original" filename (asdf0651) but the main filename 20221101asdf117

for now i have to do this by hand 😞

thanks in advance for any help!

This topic has been closed for replies.
Correct answer Jim Wilde

thats great! do you have any idea how to write "preserved filename" into an iptc field?


quote

thats great! do you have any idea how to write "preserved filename" into an iptc field?


By @toklas

 

Have a look at this LrC plug-in from John Beardsworth, that may allow you to copy the data in the Preserved Filename field to one of the IPTC fields, so you could do that before exporting: http://lightroomsolutions.com/plug-ins/search-and-replace/#:~:text=Search%20Replace%20Transfer%20is%20a,before%20or%20after%20existing%20text

5 replies

toklas
toklasAuthor
Inspiring
November 20, 2022

to be more specific: "augias" can read iptc or exif data, not any metadata. so when renaming the files, i need the old filename to be written into an iptc or exif field. i m aware that lightroom can write old filenames "somewhere" into the metadata, but this value is not one that the software "augias" that i have to use, can read out.

Community Expert
November 20, 2022

Your requirement of the metadata "original" filename to show something non-original, is a little unusual IMO.

 

Typically it's the before-import naming that people want to preserve no matter what - AFAICT that is what LrC assumes. 

 

So one tactic is to use a renaming utility on the files before import. There's then no need for any renaming at import or subsequently; hence the "original filename" and the current filename seen within LrC will naturally match. Your later export would preserve this metadata while its filename would get a suffix of the appropriate sequence number.

 

Another tactic may be: don't rename the camera original file at all. Your export renaming can prefix the date of capture (working from image metadata) and also suffix a sequence number. In the postprocessing section of the export dialog you can then call Exiftool with a command-line instruction that suitably updates the "original filename" metadata field within the output. For example: to show the exported filename with the sequence suffix stripped off; or else, to prefix the "original filename" with the date of capture, without adding any sequence suffix. AFAIK exiftool is not going to be able to add that varying suffix across a batch - I believe it will consider each image separately and singly. 

 

I suppose there's also the option of a file renaming utility adding this sequence number after export. In any case the main working image within the Catalog is never going to 'know' about this.

 

Anything like this takes a bit of effort to research, set up and test - but that effort pays for itself many times over. The separate use of another utility beforehand does add some extra steps, with possibility of pilot error, onto each future import. OTOH a more complicated export (once that's encoded into an export preset for repeatability) can do its job with zero extra work, zero extra risk of pilot error, on your part.

toklas
toklasAuthor
Inspiring
November 20, 2022

hi! thanks for your long answer. i m not familiar with exiftool so far. i will definetly check it out. just a quick question: is ist possible to write an old filename while renaming into an iptc or exif field?

Community Expert
November 20, 2022

Exiftool can take attributes of an image including the content of its metadata fields, and use those to update the image in various ways (or to make a modified copy of that).

 

As an example: a copy of the Exiftool utility including commandline options within its file name as below, adds the "specialtag" keyword into the EXIF of an image file, saves the changes to the same file, then exits. You can drag-drop a file (or many files) onto this application icon and that changes those files accordingly. You can also invoke the same kinds of actions as postprocessing to a LrC export.

 

 

Jim Wilde
Community Expert
Community Expert
November 20, 2022
quote

so the filename i want to write into the metadata is not the "original" filename (asdf0651) but the main filename 20221101asdf117

 

Obviously I was confused by this!

Jim Wilde
Community Expert
Community Expert
November 20, 2022

I don't uderstand the problem. There is a standard rename template in the Export dialog which is "Filename - Sequence", which does exactly what you want, i.e. uses the current filename (not the "original filename, that's a separate option) and adds a sequence number. If you don't want the spaces and the hyphen before the sequence number, simply choose the Edit option and make whatever changes you like then save as a new template for subsequent re-use. Just make sure you select "Filename"

toklas
toklasAuthor
Inspiring
November 20, 2022

hi! thanks for your description of an alternative workflow. but i need the old filename to be written into the metadata. it doesnt help me, if the old filename ist part of the new filename. its not my choise, but those are the conventions of the institution i m working for.

Jim Wilde
Community Expert
Community Expert
November 20, 2022

So use the "Original Filename" when renaming during export. See these screenshots when importing an image that I originally renamed during import to add the capture date:

 

If I use "Filename" in the rename template editor:

 

 

But when I use "Original Filename" I would get this:

 

F. McLion
Community Expert
Community Expert
November 15, 2022

If you rename within LrC - NOT during import - the old filename gets registered to the metadata and is available/visible.

--- Got your issue resolved? Please label the response as 'Correct Answer' to help your fellow community members find a solution to similar problems. ---
toklas
toklasAuthor
Inspiring
November 16, 2022

Hi!
thanks for your reply.
i cant reproduce what you said. when i rename in LR to "1", i see the "original filename" the file had in the camera. (asdf_0651), but not the one i gave the file in LR (20221101asdf117).
thanks for clarifying!

F. McLion
Community Expert
Community Expert
November 20, 2022

Ohh ... they changed the behavior! I just double-checked with old imports and new ones with current version of LrC.
I never looked at that for maybe years.

 

Here's how it was: If you renamed during the import, then the original filename field was not populated and the original file name from the camera was gone for good.

If you then renamed "again", the name you renamed to during the import was written to the original filename field and could also be restored. If I understand you correctly, that is actually what you want, right?

 

Here's how it is now on my end: During first import with rename, the original name from camera now is registered as the original name! And it is not overwritten if you rename again.

 

That said, it looks like you're out of luck.

--- Got your issue resolved? Please label the response as 'Correct Answer' to help your fellow community members find a solution to similar problems. ---