Parsing a File Name

I am trying to parse a file whose name of is in the form v32_16.0.7870.2038.cab. I would like to get all of the characters prior to the .cab.

This is what I have that is not working:

preceding text of fourth “.” of (file whose (name of it ends with “.cab” and name of it contains “_”) of folder “c:\programdata\xxxxx\ProgramCache\Microsoft\O365\2016\Office\data”)

Hey Mike, would something like this work for you?

q: preceding texts of lasts ".cab" of "v32_16.0.7870.2038.cab"
A: v32_16.0.7870.2038
T: 0.052 ms
I: plural substring

Haven’t tested this yet:

preceding texts of lasts ".cab" of (files whose (name of it ends with ".cab" and name of it contains "_") of folder "c:\programdata\xxxxx\ProgramCache\Microsoft\O365\2016\Office\data")

If you end up needing to weed out unwanted files that this is catching, we could also use a regular expression.

3 Likes

I had to change it to add “as string”, and it works now, but I get a " in the front which I don’t want.

(preceding texts of lasts “.cab” of ((files whose (name of it ends with “.cab” and name of it contains “_”) of folder “c:\programdata\Apria Healthcare\ProgramCache\Microsoft\O365\2016\Office\data”) as string))

Instead of using files, try using names of files.