LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A simple "File Exists?" sub-vi?

I'm looking for a sub-vi I can use in LabVIEW, that accepts a path (folder/directory) and a filename, and returns a simple boolean that's TRUE if the named file exists in that path.
It should NOT raise a "File not found" error like the "List" vi does.

(It would be nice if the input path could OPTIONALLY contain a filename, instead of requiring the seperate filename terminal to be connected.)

By the way, I'm quite surprised I didn't find this as a pre-made block in LabVIEW's toolbox.
0 Kudos
Message 1 of 5
(3,411 Views)
I guess your problem with the file not found error is to avoid the error message, so I attach a simple vi I use to check if some file is present: it accepts a path and a filename and returns a boolean indicating wether the file is present or not without any error message window.

Hope it helps.
Roberto


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 2 of 5
(3,411 Views)
Roberto's vi also returns true when a directory with that name exists and also returns the error "file not found" in the error cluster.
Our solution discriminates between files and directories, supresses the "file not found" erorr but passes all other errors. It uses a subvi to point the error more precisely in case of an error.
(Also attached)
greetings from the Netherlands
Download All
0 Kudos
Message 4 of 5
(3,411 Views)
THANK YOU!
0 Kudos
Message 5 of 5
(3,411 Views)
The 'File/Directory Info' function comes close to what you want. You find
it in the functions palette 'File I/O'-->'Advanced File Functions'.
Wire a path control to the input, unbundle the boolean status indicator
from the 'error out' cluster and negate it.
You can easily make a subvi of this, but it's probably overkill. The path
control should contain a full path to a file.

Franz

citizenDAK schrieb:

> I'm looking for a sub-vi I can use in LabVIEW, that accepts a path
> (folder/directory) and a filename, and returns a simple boolean that's
> TRUE if the named file exists in that path.
> It should NOT raise a "File not found" error like the "List" vi does.
>
> (It would be nice if the input path could OPTIONALLY contain a
> filename, instead of requirin
g the seperate filename terminal to be
> connected.)
>
> By the way, I'm quite surprised I didn't find this as a pre-made block
> in LabVIEW's toolbox.

--
Dr. Franz Josef Ahlers
Section Semiconductor Devices
Physikalisch-Technische Bundesanstalt
Bundesallee 100
D-38116 Braunschweig
phone: (+49) 531 592 2410
fax: (+49) 531 592 2405
Message 3 of 5
(3,411 Views)