Author Topic: odd sub string extraction  (Read 3953 times)

Offline k_bennett

  • Newcomer
  • *
  • Posts: 14
    • View Profile
odd sub string extraction
« on: August 15, 2008, 11:14:15 AM »
Hi, Kirk,

I am familiar with the standard substring extraction during Renaming. However, I now have an odd request. I have several hundred photos with the filename as so:

emailaddress8fnum.cr2

Where emailaddress8 is the persons email address ending in the number 8, and fnum is the frame number from the camera. I want to delete the Frame Number and leave the Email address intact. The problem is that the email address can be any number of characters from 4-7, depending on the length of the person's last name and whether or not they have a middle initial. So my current filenames include

joneab81234.cr2 or
lik81235.cr2

And I want joneab8.cr2 and lik8.cr2 as the final names.

Is this possible? It would be easy if the email addy's were a consistent length. But I can't seem to figure out how to work backwards from the ".cr2" part of the filename.

Thanks.

Ken Bennett

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: odd sub string extraction
« Reply #1 on: August 15, 2008, 12:06:45 PM »
Ken,

I am familiar with the standard substring extraction during Renaming. However, I now have an odd request. I have several hundred photos with the filename as so:

emailaddress8fnum.cr2

Where emailaddress8 is the persons email address ending in the number 8, and fnum is the frame number from the camera. I want to delete the Frame Number and leave the Email address intact. The problem is that the email address can be any number of characters from 4-7, depending on the length of the person's last name and whether or not they have a middle initial. So my current filenames include

joneab81234.cr2 or
lik81235.cr2

And I want joneab8.cr2 and lik8.cr2 as the final names.

Is this possible? It would be easy if the email addy's were a consistent length. But I can't seem to figure out how to work backwards from the ".cr2" part of the filename.

If you use a negative value for the count, I think that should work.  So try:

{filenamebase:0,-4}

HTH,

-Kirk


Offline k_bennett

  • Newcomer
  • *
  • Posts: 14
    • View Profile
Re: odd sub string extraction
« Reply #2 on: August 15, 2008, 12:12:18 PM »
Yup, that works, thanks. I thought I had tried every possible combination of numbers but I obviously missed this.

Thanks again.

--Ken