Example Code

Find Next Available File Path

Code and Documents

Attachment

Overview
This example VI Demonstrates the use of Build Path and Stripe Path functions to find next available file path name by appending a number to the file path.


Description

This VI will take in a file Path that points to a .csv file, and if that file already exists, it will append a number to the end of the file name and recheck until it finds a valid file name that is not in use. For example if Path points to test.csv, if test.csv does not exist, Path Out will be test.csv, but if test.csv already exists, Path Out will be test1.csv, and if that exists it will be test2.csv and so on.

 

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Download the attached folder to your computer
  2. Open the VI " Next Empty File Path 2012 NIVerified.vi"
  3. Enter a Path
  4. Run the program

 

Additional Information or References
VI Snippet

Block Diagram.PNG

 

 **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.

Comments
rgovoro
Member
Member
on

Thanks, this is just what I was looking for!