To download NI software, including the products shown below, visit ni.com/downloads.
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
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.