LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the file property

Solved!
Go to solution

I need to take some action as soon as a file has been changed.

 

I donot want to polling the file content all the time. Can I check the modified time property of the file.

 

May I know how to do it. Thanks.

0 Kudos
Message 1 of 5
(4,712 Views)
Solution
Accepted by alex.

If you don't want to do polling then you need to use a callback. How you do this depends on which operating system you're running, which is.... ???

 

For example, on Windows, you can try to use the Windows API, like FindFirstChangeNotification (good luck with that). Alternatively, you can use the .NET FileSystemWatcher class. Examples ship with LabVIEW to show you how to do callbacks for .NET. Something like this:

 

 

Message 2 of 5
(4,700 Views)

Hello everyone!

 

I've followed the example and it works fine. I want to use this solution to manage a data file when this new file is created in a directory that my application is "watching". So, how can I retrieve the file name using this solution?

 

Greetings!

Francisco José Gómez López
Software Engineer
0 Kudos
Message 3 of 5
(4,088 Views)

You need to look at the documentation for the FileSystemWatcher class. If you set the "filter" to an empty string, then it will watch for any changes to the directory, rather than to a specific file in that directory. The Changed event will return the name of the file that was changed.

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

Finally, I get the answer. Using a Property Node connected to the VI Server Reference, as you can see in the image.

s.vi_watchFileName.JPG

Greetings!

Francisco José Gómez López
Software Engineer
0 Kudos
Message 5 of 5
(4,056 Views)