What's the deal with FilFindFile and FilSearchPath?

Title says it all. I’m attempting to search for files using partial file names in a single directory. In the HSLFilLib, there is a submethod called FilFindFile. The Help section for this says it can use wildcard characters * and ?, which is very useful for my purposes. However, it also says it is obsolete and that I should use FilSearchPath instead, which does NOT appear to work with wildcard characters.

Is there any harm in using FilFindFile? Or is there a way to use wildcard characters/search partial file names with FilSearchPath? Any guidance would be appreciated!

Hi @spazianim,

The FilSearchPath function does accept wildcard characters, it just doesn’t list it in the Help file. I ran tests with the * and ? wildcards and was able to successfully return files and folders at the given directory/syntax. For example “C:\Program Files (x86)\Hamilton\Methods\*.med” returned the first .med file in my Methods folder.

Can you share the syntax you tested for this function? Also, what version of VENUS are you using?

Thank you,
Dan

2 Likes

Hey Dan! Thanks for the response.

I am using VENUS version 4.5.0.7977. Below is the code that I am using:

The input strings for FilSearchPath and FilFindFile are identical. However, when I run it, the path only comes back for FilFindFile:

This appears to be the case if the two submethods are run independently or if the I reverse the order of the submethods. Can you tell me if I’m missing something?

Thanks again!
Matt

Hi @spazianim,

You aren’t missing anything. What you’re experiencing is differences in VENUS/HSL versioning. Since you’re on VENUS 4, you’re good to stick with using the FilFindFile function.

Thank you,
Dan

1 Like

Hey Dan,

Awesome - thanks for that info! I will stick to that for now.

Matt

Can you please share the library for this? Thank you

Hi @MSMDG,

The HSLFilLib is a default library that is installed alongside VENUS. You can find it in the “Hamilton\Library” folder.

Thank you,
Dan

2 Likes

Thank you Dan