LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor new file on folder

Solved!
Go to solution

Hello,

 

Here is my problem : I try to monitor a folder and when a new file is created, i want to know it.

 

I ckecked so many discussion and I saw "FileSystemWatcher" which seems to work with Labview.

 

So, is it possible to do the same thing with Labwindows/CVI 2017 ?

 

Thank you in advance.

0 Kudos
Message 1 of 5
(3,108 Views)

I published a slightly different program sample that monitors changes to a single file in a folder relying on a system notification. You can look at it as a starting framework to develop your own function. My example can be found here.

 

NOTE It's been a while since I've developed this example and I see no note on the page so I may be wrong, but I seem to remember that this mechanism fails when trying to monitor a file on a remote folder



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 5
(3,102 Views)

Thank you for your program.

 

But the problem is to check any new file, not just one.

0 Kudos
Message 3 of 5
(3,095 Views)
Solution
Accepted by topic author Bastienm

As you may find by reading it, my code relies on FindFirstChangeNotification Windows API, which monitors for every change in the target folder; limiting the inspection to a single file is a supplementary operation performed after the event is received by the thread. Passing FILE_NOTIFY_CHANGE_FILE_NAME to the function as the filter condition will trigger the notification even for file creation.

After receiving the event, you may want to refine the and filter the events by using ReadDirectoryChangesW function, which is a bit more complex to use than the former one and I didn't tried to implement in CVI.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 4 of 5
(3,072 Views)

Hi, 

 

Can we monitor continously any folder for new files, using teststand alone?

 

0 Kudos
Message 5 of 5
(1,894 Views)