But ${SEQUENCE} isn’t quite what I want… this is the sequence number within the import job (starting from 0000). What I want is the original frame number from the camera reel. This frame number is in ${FILE_NAME} but ideally I don’t want the redundant part of it, i.e. I don’t want DSC_5798 but only 5798.
I don’t think we have that variable. I’m not even sure it is a variable within the metadata. Some cameras do have a cycle count in the metadata. What’s available via exiv2 in your raw file?
Of course, it would also be possible to extract the frame number from the file name using something like a regexp ^DSC_(\d+)\.NEF$… not sure what is possible with scripting but I’ll check it out.
There are ways to manipulate darktables variables like ${FILE_NAME}. Things like ${FILE_NAME:4:4} or ${FILE_NAME#DSC_}. See the full description in the manual.
Though I’ve never used those options, let alone during import…
So I think you would be able to use string subst feature of the variables …following on what @rvietor suggests…
I don’t do it for export but here I shared how I export my jpg edits in a way that automatically names them to match the raw files but it creates a parallel set of folders one with the raw files and xmp and one with only the edited exports…makes it easy to scroll through and view them… and it keeps the same file structure in both…
Basically you specify the variable, then a “/” search pattern, “/” what to replace that with…
You might be able to work that out to give you what you need on import…
Thanks @priort and @rvietor. I hadn’t spotted those string substitution possibilities because I was looking in the import part of the docs, where that isn’t mentioned.
I can confirm that ${FILE_NAME:4:4} and ${FILE_NAME#DSC_} both work.
For completeness, I’m curious whether this could also be extracted directly from the EXIF without any scripting. From the linked docs page above I see that you can specify e.g. $(EXIF.FOCAL.LENGTH.EQUIV), so it would be neat if you could also specify any custom EXIF element, like my Exif.NikonFi.FileNumber… doesn’t seem to work but it would be nice if it did.
Good question. It’s not particularly useful but it’s just following my general approach of not wanting to lose anything from the original (other than something useless like DSC_). I know the full file name is preserved in the metadata (and is in the Nikon-specific EXIF), but I just like to keep the same info that was in the original file name… in the new file name.