Waterppk Posted October 2, 2009 Report Share Posted October 2, 2009 I searched around the forums/online and I can't seem to find anyone who's used LabVIEW to monitor folders for changes in files/folders. I'm collecting data on a network drive in my building and then hoping to have my data post processor monitor that folder for generated data, when data is generated I then want the post processor to automatically process the data but not touch any old data. Any thoughts? Quote Link to comment
Ton Plomp Posted October 2, 2009 Report Share Posted October 2, 2009 I know that someone posted an xcontrol with this functionality. ton Quote Link to comment
Christian_L Posted October 2, 2009 Report Share Posted October 2, 2009 I searched around the forums/online and I can't seem to find anyone who's used LabVIEW to monitor folders for changes in files/folders. I'm collecting data on a network drive in my building and then hoping to have my data post processor monitor that folder for generated data, when data is generated I then want the post processor to automatically process the data but not touch any old data. Sounds like a very good application for LabVIEW. Here's a simple example of implementing this. Quote Link to comment
ShaunR Posted October 2, 2009 Report Share Posted October 2, 2009 (edited) Sounds like a very good application for LabVIEW. Here's a simple example of implementing this. Be even better if we could catch windows messages in the event structure! Edited October 2, 2009 by ShaunR Quote Link to comment
Ton Plomp Posted October 3, 2009 Report Share Posted October 3, 2009 Be even better if we could catch windows messages in the event structure! I should have make it more clear but the XControl I linked to uses the windows messages for this. I know that someone posted an xcontrol with this functionality. ton Quote Link to comment
ShaunR Posted October 3, 2009 Report Share Posted October 3, 2009 I should have make it more clear but the XControl I linked to uses the windows messages for this. Well. Yes and no. It uses .NET so its a bit like saying a vi creates Word documents when, in fact, it is an automation interface to Microsoft Word and Word creates the document. No word, no document. No .NET, no messages. Quote Link to comment
shinton Posted May 1, 2014 Report Share Posted May 1, 2014 Be even better if we could catch windows messages in the event structure! I know that someone posted an xcontrol with this functionality.ton The disadvantage of using the .NET solution is that it can't be implemented on a real-time target. If I want my RT controller to FTP a log file to me whenever a new one is created then I'll have to use something like Christian_L's example above (which looks pretty good to me). Quote Link to comment
Omar Mussa Posted May 1, 2014 Report Share Posted May 1, 2014 I didn't look at Ton's attachment but I have done this in the past using a .NET System Filewatcher Object and registering a callback VI for when the .NET event fires. It works pretty well, the only challenge was that the callback was called in a LabVIEW context that you can't debug directly. 1 Quote Link to comment
shinton Posted May 1, 2014 Report Share Posted May 1, 2014 I know that someone posted an xcontrol with this functionality.ton Also here is another post with a similar (.NET) solution. I haven't looked at both to compare them. Quote Link to comment
Omar Mussa Posted May 1, 2014 Report Share Posted May 1, 2014 Sounds like a very good application for LabVIEW.Here's a simple example of implementing this. foldermonitor.PNG BTW - the problem with doing the array checking for this operation is that it can become a pretty big performance hit to poll the folder and list all files and search for all changes, especially if the number of files grows large. Plus, you may need other features (like file removed or file updated) and you end up with more and more trouble when you try to recreate that functionality. I think the .NET solution is the best long run solution for this problem (as long as you're on a Windows platform). Quote Link to comment
GregFreeman Posted May 1, 2014 Report Share Posted May 1, 2014 (edited) BTW - the problem with doing the array checking for this operation is that it can become a pretty big performance hit to poll the folder and list all files and search for all changes If you are on a non windows OS, you could use the "get file/directory info" VI and just monitor the last mod timestamp. Then only call the directory listing once at startup to get the initial list, and any time the last mod timestamp changes. This reduces the number of times it needs to do the list/compare. Edited May 1, 2014 by GregFreeman Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.