LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to check a file in a period of time

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.

0 Kudos
Message 1 of 4
(2,813 Views)

Here you go.

 

Happy Thanksgiving!

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 4
(2,805 Views)

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 

 

0 Kudos
Message 3 of 4
(2,784 Views)

Thanks for answers and for suggestions! I want to check it every minute or 5 minutes. I will try.

0 Kudos
Message 4 of 4
(2,747 Views)