LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search Files: How can Labview �tell� whether a file exits.

I am trying to create a system that saves data by serial number. The name of the file will be in the format of serialnumber.xls.
My question is, is there anyway to programmatically search whether the �serialnumber.xls� already exists in a directory? (As I need to establish different cases depending whether the file already exists in the directory).

Thanks,

FightonSCTrojan
0 Kudos
Message 1 of 4
(2,717 Views)
You can use the File/Directory Info function (File I/O>Advanced File Functions palette). If it returns an error code 7, the file doesn't exist.
Message 2 of 4
(2,717 Views)
The simplest method to test if a file exist is to use Access Rights function from the File I/O >> Advanced File Functions palette. If this function gives an error in the error out cluster the file does not exist.

Waldemar
Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
0 Kudos
Message 3 of 4
(2,717 Views)
I think the File/Directory Info function is the best answer too because you can check to see if the path is a directory or not. Although it is unlikely that someone will create a "serial.xls" as a directory, whenever I am programming in any language I always check to see if it exists AND is a file or directory (depending on what I am expecting).
0 Kudos
Message 4 of 4
(2,717 Views)