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.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Why FindFile() cannot support *.txt this kind of file name?

I want to find a TXT in the current folder where the sequence is.Because the TXT name is not fixed,so every time I need to search and then get the path.

But FIndFile() cannot support a *.txt like below:

FindFile("*.txt", True, Locals.Path, 3)

 

Anyone has a solution?

 

Thanks!

0 Kudos
Message 1 of 5
(4,444 Views)

How does the txt file get named?  How do you know there will only be one txt file in that folder?

 

You could use a code module to parse through the files and return the path to the txt file.  For example if you were using LabVIEW you could use the List Folders function and then parse for txt files.

 

If you want to keep it native to TestStand I think it would be tricky.  You might be able to do something with the Call Executable step and some DOS commands.

 

If it were me I'd go with the code module option.

 

Ideally you'd know the name of the file and use the FindFile() like you are trying to.  Is there any way to get the name of the txt file?

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 5
(4,435 Views)

The txt file  is provided by different users,so I don't know the file name.

I don't need to concern about the content of the txt,just read the txt file.

0 Kudos
Message 3 of 5
(4,422 Views)

If you want to do a file system search you can use a .NET action step and set it to use mscorlib, and the System.IO.Directory class and then call the GetFiles method.

 

Hope this helps,

-Doug

0 Kudos
Message 4 of 5
(4,401 Views)

Hi,

 

Maybe you could try to use the Engine.SearchFiles method (and then the Search Classes).

 

Or you can open the file "ForEach.seq" in <TestStand Path>\components\tools and take a look at the "FindFiles" sequence.

 

Regards

Bruno

0 Kudos
Message 5 of 5
(4,341 Views)