Author Topic: Parse {filename} with embedded delimiters  (Read 1237 times)

Offline FairfieldPhoto

  • Full Member
  • ***
  • Posts: 236
    • View Profile
    • Fairfield Photography, LLC
Parse {filename} with embedded delimiters
« on: February 13, 2021, 06:53:18 AM »
I will be receiving files for a project with the filename containing data about the image (the people supplying the image files refuse to use IPTC fields).

Filename structure is: <email address>&<Name>&<random nonce up to 6 digits, no leader zeros>&<filename>
Example: john.smith@gmail.com$John Smith$71543$IMG_2443.jpg

I am currently exporting all the filenames in the folder to a text file, importing that text file to excel, using some formulas to bust out the data fields into individual columns and feeding that text file back to PM as an IPTC text replacement file using \{filename}\ as the key.  Ugh.

As part of field manipulation, do you have a recommendation on how I could parse {filename}and extract the fields to designated IPTC target fields all within PM?  I have some ideas for a function in case this can't be done currently.

-Mike


Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Parse {filename} with embedded delimiters
« Reply #1 on: February 13, 2021, 08:43:21 AM »
Mike,

I will be receiving files for a project with the filename containing data about the image (the people supplying the image files refuse to use IPTC fields).

Filename structure is: <email address>&<Name>&<random nonce up to 6 digits, no leader zeros>&<filename>
Example: john.smith@gmail.com$John Smith$71543$IMG_2443.jpg

I am currently exporting all the filenames in the folder to a text file, importing that text file to excel, using some formulas to bust out the data fields into individual columns and feeding that text file back to PM as an IPTC text replacement file using \{filename}\ as the key.  Ugh.

As part of field manipulation, do you have a recommendation on how I could parse {filename}and extract the fields to designated IPTC target fields all within PM?  I have some ideas for a function in case this can't be done currently.

Variable Substring Extraction isn't going to work well because the field lengths vary.

Scripting to produce the Code Replacement file is the way to go.

-Kirk