NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Test for System File and Delete System File

I have about 300 different tests that I run using TestStand, each with a somewhat unique report output filename:

  Example:  0-RMC 80 Timer_Interface_MaxValue_Report.html

The filename includes the

    Number of Errors

    Product Name

    Build Revision

      and a unique test name.

 

I would like to add a step to an existing initialization routine to test for an existing report file name and if it exists, bypass the test sequence.

 

The question is, how do I run a system command within TestStand to test for a file, for example:

  If (SystemCommand(dir Locals.ReportPath\0-RMC 80 Timer_Interface_MaxValue*.html) then

    Don't run this test...

 

Similarly, I also need to know how to delete a file from within TestStand.

    SystemCommand(Del 9999*.*)

 

Mike

               

0 Kudos
Message 1 of 2
(3,050 Views)

You can use the FindFile method in the TS API:

FindFile Method

Syntax

Engine.FindFile ( fileToFind, absolutePath, userCancelled, promptOption = FindFile_PromptHonorUserPreference, srchListOption = FindFile_AddDirToSrchList_Ask, isCommand = False, [currentSequenceFile])

 

The function itself returns a boolean which indicates if the file exists or not. 

 

Then just use a Call Executable step to run command line string to delete the file.

 

Hope this helps!

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