Author Topic: Remove sequence from end of filename base when filenamebase is added as keyword?  (Read 780 times)

Offline MegMac

  • Newcomer
  • *
  • Posts: 5
    • View Profile
BEFORE ingesting to Photo Mechanic, I have files that already have a sequence at the end of the filename. That's because I prefer to use other software for renaming.
example: file name (1).jpg

I want to ingest these files and rename to add date to file name:  {iptcyear4}-{iptcmonth0}-{iptcday0} {filenamebase}
AND add the filenamebase as keywords via settings in the IPTC :  Keywords: {filenamebase}
(and also use ingest to organize by YYYY folder and other very efficient PM tasks!)

Result: the sequence from the original filename: (1) for example, becomes a keyword. I don't want (1) as a keyword.

Is there a way to use variable substring extraction to remove the last 4 characters from filenamebase ? (Assuming the sequence is 3 characters plus a space, as in the example)

I looked at the variable substring extraction examples from the manual and tried to make something work but I did not succeed.   

I know I could use Find and Replace later (replacing with a space) to remove these unwanted 'keywords', but I'd have to do a separate Find and Replace for each seqn: (1), (2), (3) etc.

I am hoping there is a way to use variable substring extraction. Is there?
Any other suggestions?

Thank you.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 18403
    • View Profile
    • Camera Bits, Inc.
BEFORE ingesting to Photo Mechanic, I have files that already have a sequence at the end of the filename. That's because I prefer to use other software for renaming.
example: file name (1).jpg

I want to ingest these files and rename to add date to file name:  {iptcyear4}-{iptcmonth0}-{iptcday0} {filenamebase}
AND add the filenamebase as keywords via settings in the IPTC :  Keywords: {filenamebase}
(and also use ingest to organize by YYYY folder and other very efficient PM tasks!)

Result: the sequence from the original filename: (1) for example, becomes a keyword. I don't want (1) as a keyword.

Is there a way to use variable substring extraction to remove the last 4 characters from filenamebase ? (Assuming the sequence is 3 characters plus a space, as in the example)

I looked at the variable substring extraction examples from the manual and tried to make something work but I did not succeed.   

I know I could use Find and Replace later (replacing with a space) to remove these unwanted 'keywords', but I'd have to do a separate Find and Replace for each seqn: (1), (2), (3) etc.

I am hoping there is a way to use variable substring extraction. Is there?

If the number of digits is inconsistent then it will be difficult to trim from the right side of {filenamebase} and have it work consistently.  However, if the leading part of the name is consistent, then you can extract the leading characters.

{filenamebase:0,9} will extract "file name" from "file name (any number of digits here)"

Please provide more examples (as exact as you can) and I will assist you further.

-Kirk

Offline MegMac

  • Newcomer
  • *
  • Posts: 5
    • View Profile
Thanks Kirk.

examples:
vacation (01).jpg
vacation (02).jpg
florida_vacation (01).jpg
florida_vacation (02).jpg

Let's assume the number of digits (characters comprising the sequence) is consistently 5 : space(01)

The leading part of the name is NOT consistent, and I want to KEEP the leading part.

as I have it set up currently, several keywords will be created and added to the keyword field. These keywords, as per my file name examples, would be:
 (01)
 (02)

so, is there a way to variable substring extraction? I want to trim 5 characters/digits from the right side of every filename.
And yes, I realize that adding words from the filename as keywords and in caption seems redundant, but that's what I'm doing.

I can't think of any way to explain it more clearly!

OR: can I use find/replace with multiple values? I have been looking through the forum and have seen a couple of references of inputting multiple lines in the 'find' box, but I can't get it to work. 

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 18403
    • View Profile
    • Camera Bits, Inc.
{filenamebase:0,-5} should do exactly what you're wanting.  You will run into trouble if your digits exceed 99.  If that never will happen then it should always do what you're trying to do.

-Kirk