NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Teststand alone, can we monitor a folder for any new files creation?

Is it possible to monitor a folder for any new files using teststand?

0 Kudos
Message 1 of 8
(1,375 Views)

Hi uma1328,

 

Can you be more specific about what you would like to do with the folder?  Are you interested if the folder exists or in the folders contents......?

 

Ah just read the title, my bad.

 

Steve

0 Kudos
Message 2 of 8
(1,368 Views)

There is a FindFile function that can be built into an Expression using the expression browser.  You could use that to poll the folder for new entries. See here for details of the function.

0 Kudos
Message 3 of 8
(1,363 Views)

Hi Steve, 

 

Thank you for your reply.

 

Is this FindFile function is used to find any particuar file? or can we monitor any number of files which is created newly in that particular folder? ex: any file like .jpg, .txt, .seq?

0 Kudos
Message 4 of 8
(1,352 Views)

Yes, the first parameter for FindFile is the path of the file that you would like to find, you can specify the path to any time of file that you like (as far as I am aware). 

 

If you are looking for the arrival of new files into your folder then I would go for a code module, the file operations within the code module language (e.g. LabVIEW) will give you far more flexibility when it comes to doing what it sounds like you would like to do.

0 Kudos
Message 5 of 8
(1,346 Views)

You can also use .NET File.Exist() and other System.IO methods for free (no additional coding needed since it is installed with Windows).

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 6 of 8
(1,303 Views)

Hi Michał Bieńkowski,

 

Thank you for your reply. I wanted to know whether this .NET File.Exist() function will try to find any specific file or it will give any arrival of files recursively? If i place set of files in a folder, teststand should detect the arrival of the files in the folder.

 

This link has a solution to my query using python:

How to create a watchdog in Python to look for filesystem changes | The Python Corner

 

Similar solution i need using teststand.

0 Kudos
Message 7 of 8
(1,285 Views)

What do you mean by "recursively"? In subfolders? If so, File.Exist() will not work since you need to provide file path. I think there is also something to list folder files (perhaps even recursively). So, you can call this function in a while loop until you find new file in the folder (or if number of files change). I recommend to look at System.IO lib at Microsoft site to see what can be accomplished: https://docs.microsoft.com/en-us/dotnet/api/system.io?view=net-6.0

 

Something similar to your Python example would be FileSystemWatcher, I guess. But I never used it and honestly I don't know how to handle .NET events in TestStand. That is why I suggested polling loop.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 8 of 8
(1,266 Views)