How can I check if a file already exists? I need this function as I want to create a specific file every month but only one time, so I hope anybody can help me!!!
If you only want to make a file once every month then surely it is
safer to use the 'current 'date in the file name thus you will never have two files with the same name !!
This is the way I usually check for the existance of files. Use the Get File/ Directory information VI and check the return code for 7 (File does not exist).
Once upon a time, I searched through the discussion forum archives to
find the answer to this very answer. I ended up doing it the
following way (see attached VI); though there are doubtless better
ways. I look at the index output of "Match First String.vi" to
see if it is greater than -1. The input to "Match First
String.vi" is from "List Directory.vi" This is given the name of
the directory you want to search (where you store your data files for
instance). You might also check that the user does not try to
give the file a blank or "null" name to avoid loss of precious data.