To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This code allows the user to create a New File, if it exists the VI add a number at the end of the file name.
If you try to create MyFile.dat and it already exists this VI will open a file named MyFile1.dat and pass back a reference to this new file. If several numbered files exist it will find the next available number.
Description
This VI checking if the File Name is already exists (error code = 10) that determines to add a number at the end of the File Name. Using Strip Path with Search/Split String functions it gets the File Name and the Extension. With a initialized Shift Register, Increment and Number to Decimal String function it gets the number to add. Using Concatenate and Build Path, creates the New File Name.
The While Loop executes until there is no error in the Open/Create/Replace File Function.
Requirements
LabVIEW 2012 (or compatible)
Steps to Implement or Execute Code
Additional Information or References
**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.