Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating and Opening a File from a Non-existent File Path using LabVIEW

Overview
This example highlights how to dynamically and programmatically create a file and open a reference to it, when both the file and the directory structure need to be created.


Description
Without creating non-existent folders in the specified file path, an "Error 7" error is caused by the "Open/Create/Replace File" vi. This example shows how to prevent this error from happening. 

"Create Folder vi" is used to create the missing folders, only if they don't already exist. The "Create Folder vi" causes an error if the specified file path already exists, so if it does already exist, we don't want to call the "Create Folder vi".  To accomplish this the "Check if file or folder exists vi” is used to control the case structure with the "Create Folder vi" inside.

 
Requirements

  • LabVIEW 2012 Base Development System (or compatible)


Steps to Implement or Execute Code

  1. Download the VI “Dynamically Create Directory 2012 NIVerified.vi”
  2. Run the program

 

Additional Information or References
VI Block Diagram

block.png

 **This document has been updated to meet the current required format for the NI Code Exchange.**

Product Support Engineer
National Instruments