Showing results for 
Search instead for 
Did you mean: 

Check if file or folder exists


I am using the Check if file or folder exists vi. I have a case structure set up for my data to either append to the recognized excel file or create a new report if not based off the example from However, I don't understand how to create a new file name if the folder does not exist and a new one needs to be created. I need something that will work like the file dialog vi where it will prompt and ask what to name the file and then save it. Any help would be appreciated.




Message 1 of 6

Simply call the File Open VI with no file name wired. This bring up the file dialog box for the user.

Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 6

Thank you very much.


Would it be possible to have the excel files named as something that will be entered on the front panel, such as a username that the user will enter to log on? The goal of our code would be as follows:  a user logs in on the front panel, data is collected, and then data is logged to an excel file saved as the username. We would use the check if file or folder exists because there will be repeat users and their data will need to append to their file, but there will also be new users that will need to have their data logged to a new file for future use. I hope I am being clear enough. Thanks in advance, as any help would be greatly appreciated.

0 Kudos
Message 3 of 6

You can make the names whatever you want. You, as the programmer, create the name using the File I/O functions (such as Build Path and Strip Path) and the String functions (for creating the name based on a pattern). That said, it's a bit unusual to name files based on a username. Typically you have some other pattern. Why would you want the filename to be the user's name?


To learn more about LabVIEW it is recommended that you go through the introduction material, tutorial(s), and other material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

0 Kudos
Message 4 of 6

You can use the attached VI to get the Windows user name. If you have a separate LabVIEW Login module developed, you could always use a file to store the username and read it while creating the file.

Certified LabVIEW Architect, Certified TestStand Developer
"What you think today is what you live tomorrow"
0 Kudos
Message 5 of 6

Those are the requirements for the program I am designing. The username string needs to be the name of the folder that the data is saved in, and if it already exists it just needs to append to that file. I need an example of how to wire the username string to a function that creates or updates a folder. 

0 Kudos
Message 6 of 6