From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search files which filename contains a speicific string

Solved!
Go to solution

Hi

 

I'm lookng for a way to find all files in a directory which part of filename contains a specific string.

e.g.:

string = hello

files;

- 1hello2.txt

- 22he45.txt

- gehello42353.txt, ....

The result should be either an index or the complete filename that matches. In the example I'd found index 0 and 2, or 1hello2.txt and gehello42353.txt.

 

Actually I have the list of the files with the "recursive list.vi".

 

Any suggestions are welcome.

Thanks for your precious help

Yves

0 Kudos
Message 1 of 2
(7,537 Views)
Solution
Accepted by topic author Yves

You can use List Folder - function with *hello* -pattern.

 

From there you get filenames, which include that specific pattern.

 

 

 

 

If you allready have list of files:

- use Scan string for tokens in a for loop and if token index != -1, then you can add that array index to the list.

 

I´m sure there are better ways to do this, but nothing I can come up with quickly.

 

Message 2 of 2
(7,535 Views)