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: 

searchfiles

Solved!
Go to solution

@Krischai81 wrote:

Hi Jigg,

 

I figured out the error in my sequence file.

When i call the "SearchFiles" Method, the parameter "directoriesAndFilePaths" was given a variable which had a path like "C:\\Test\\Example\\Search.seq". But when i replaced the "\\" with Single Slash ("\"), the sequence started working.

 

I am not sure why. I had always assumed TestStand recognizes "\\", when specifying a path instead of "\".

 

Are you aware of such situations when "\\" should be used or "\" should be used when specifying the path of a directory?

 

Thanks

Kris


If you are writing a string literal in an expression use "C:\\Test\\Example\\Search.seq", but if you are just setting the value of a path or string variable directly in the variables view, just use single backslashes. Backslashes are treated as escape characters in string literals inside of expressions only. Parameters are specified with expressions so if you are putting a string literal in a parameter edit control then it should have double-backslashes. That said I haven't looked at either of your code, but that's how it should work.

 

Hope this helps explain things,

-Doug

0 Kudos
Message 11 of 14
(1,115 Views)
Hi Doug, You are right. I have used the path directly by assigning to a variable in a variable view. So in that case I should have used Single / than the Double slash. Thanks for letting me know this. Its very useful. Regards Kris
0 Kudos
Message 12 of 14
(1,108 Views)

Hi all,

 

I ran into a similar problem. I intend to search for a file, which has a certain substrin in the filename.

 

Is it possible using the Engine.SearchFiles method to search file names?

0 Kudos
Message 13 of 14
(1,070 Views)

Hey Madottati,

 

TestStand uses regular expressions as the search string, so you can manipulate the search using wildcard characters. This is a part of the wikipedia article that I linked here. For example something like "file_name.*" should search for any file in a directory that starts with "file_name"

 

http://en.wikipedia.org/wiki/Wildcard_character#Regular_expressions

 

If you have further questions, please make a new thread. This one was already marked as solved so many user may have glossed over it. A new thread is likely to get more traffic. 

 

Best Regards,

 

-KP

 

Edit: Forgot to post the help file that said that teststand uses regular expressions (it's mentioned in the searchstring parameter description):

 

http://zone.ni.com/reference/en-XX/help/370052K-01/tsapiref/reftopics/engine_searchfiles_m/

Kurt P
Automated Test Software R&D
0 Kudos
Message 14 of 14
(1,054 Views)