LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the new file names in a directory of another PC

Hi all,

 

We are building a labview application to monitor and control a manufacturing line.

Labview is installed on the main PC that operates the line.

Since some sensors are operated on their own PCs, we want to record the timings of all measurements of these sensors on the main PC to centralize the timings of all mesurements. 

The sensors generate spc files (spectral data) more or less every 10s in a directory of their own PC.

 

How is it possible with labview to record that filename and the time (time of the main PC with labview) when the file appears on the sensors PC.

 

I tried the list folder function but it gives all files and not the new ones. 

0 Kudos
Message 1 of 7
(2,334 Views)

@brevan wrote:

 

 

I tried the list folder function but it gives all files and not the new ones. 


Well try storing the results in an array, then read it again later and compare the new list to the previous list.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(2,313 Views)

Another route you can try is to treat the original SPC file location as a temporary holding location.  After a file is detected in that location, note the time and move it to an "archive" folder.  This way, your normal save location is normally empty, unless a new file appears.  Additionally, you will avoid timing issues later on as the number of files increase.  The list folder function will take more and more time as the folder grows.  Even small files will result in a notable increase in processing time as their numbers exceed millions within a single folder.

0 Kudos
Message 3 of 7
(2,303 Views)

I think that you should use a real server to store your data... like a NAS.

Why you are not using a database?

Benoit

0 Kudos
Message 4 of 7
(2,288 Views)

Don’t have LabVIEW here, but you can make a .NET callback function that can let you know when new files are added. It is somewhere here on the forums because that is where I remember finding it.

 

mcduff

0 Kudos
Message 5 of 7
(2,281 Views)

@mcduff wrote:

Don’t have LabVIEW here, but you can make a .NET callback function that can let you know when new files are added. It is somewhere here on the forums because that is where I remember finding it.


I just did this for TestStand.  But the System dll has a class called System.IO.FileSystemWatcher.  From there are the methods and properties that the OP needs.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(2,270 Views)

This is what I did a while back, have not used it in a few years. I do not like posting .NET and callback VIs as there are usually problems with them when I try to run them.

 

This VI watches a specific directory and sends an event if the contents change.This VI watches a specific directory and sends an event if the contents change.

 

This is the callback VIThis is the callback VI

 

 

Note in the FileWatcher VI I split the events, I remember if I tried to combine them then LabVIEW would crash, no idea whether that bug/feature has changed.

 

mcduff

0 Kudos
Message 7 of 7
(2,259 Views)