Check if a files exist with a partial string

I got a folder that may have files in it

file ex:
dog_213213.txt
dog_12.txt
cat_123131.txt

How could I check if I got at least 1 file named dog_*.txt?

Tried with Path Exists:
"…\folder" + animalName + “*.txt” with no result…

anyone got a solution?

2 Likes

Buddy @MaxyArthes
here is your xaml that could solve your issue
txtval.zip (2.4 KB)

Hope this would help you
kindly try this and let know whether this works or not buddy
Cheers

Hey @MaxyArthes

You can Try This -

bool FileExists - Directory.EnumerateFiles(DirectoryPath, "dog_*.txt").Any()
Writeline- FileExists.ToString()

Reference Sample - FileExistsSample.xaml (5.4 KB)

Regards…!!
Aksh

4 Likes

Thanks, that worked. :slight_smile:

1 Like

Cheers buddy @MaxyArthes
Keep going

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.