Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Compare file name without the a sub string in it's name

Hi,

I have a files with this name formats:

ab_cd_afd_2013311214304567

ab_afd_2013311214304567

etc.

Also, I have a variable containing a string with a file name disregarding the time stamp. (vFileName = 'ab_cd_afd')

I want to compare between them.

which function should I use?

Thanks,

Boris 

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Your timestamp is of fixed length, right?

Try

=left(Filename, len(Filename)-17)

edit: and to compare to your variable:

=if( left(Filename, len(Filename)-17) = vFileName, THENBRANCH, ELSEBRANCH)

View solution in original post

5 Replies
swuehl
MVP
MVP

Your timestamp is of fixed length, right?

Try

=left(Filename, len(Filename)-17)

edit: and to compare to your variable:

=if( left(Filename, len(Filename)-17) = vFileName, THENBRANCH, ELSEBRANCH)

Not applicable
Author

What about the file extension?

swuehl
MVP
MVP

Which file extension, can't see the extension in your above samples.

If you need to extract above filenames from a full path with extensions, have a look at your other current thread;-)

Not applicable
Author

That one is talking about ignoring the folders and the extension.

here I asked how to ignore the time stamp which is with the file name itself.

and the extension is csv.

I guess just change the 17 to 21?

swuehl
MVP
MVP

Yes, 21 should work for an extension '.csv' (four characters).