11-26-2015 04:24 PM
Hi,
I want to check a file regularly whether it exists, or whether it is still there. Is there any "event" or "signal" solution other than polling? I mean I prefer to avoid to check the file every time period with a timer event. Is there any other solution? Is there a signal mechanism in that I say that if this file does not exist any more, inform me (signal to my program).
Thanks.
11-26-2015 04:45 PM
Happy Thanksgiving!
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
11-26-2015 07:17 PM
I want to check a file regularly whether it exists, or whether it is still there.
James referenced an elegant solution that signals an Event when a file is added to a specified Folder. It involves using Windows calls through DLLs, and is decidedly "non-trivial" (I'm not knowledgable enough with Microsoft System Calls to have known how to do this, though I can more-or-less follow the logic presented).
If, on the other hand, you want to "check a file regularly (to see) whether it exists, or whether it is still there", there is a relatively easy way to do this entirely within LabVIEW (though it does use Timers, either in a parallel While loop or as a TimeOut Event). I note that the original statement says "check a file regularly", which I interpret as maybe once a second (or 5 seconds, or a minute), that is, not "as soon as possible after the change has been made". Thus if the Check occurs once a second, and involves a File Exists function, I wouldn't think it would be a significant processing burden. It also has the advantage of being accessible to most LabVIEW programmers (as it uses "pure LabVIEW"), and can easily be extended -- indeed, the solution that James references checks for the file being added, but not for "whether it is still there", while a LabVIEW routine could easily encompass both conditions as well as "has its size changed" or "has it become "hidden".
You Pays Your Money and You Takes Your Choice.
Bob Schor
11-27-2015 04:59 AM - edited 11-27-2015 04:59 AM
Thanks for answers and for suggestions! I want to check it every minute or 5 minutes. I will try.