LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
moderator1983

Append auto incrementing number to the file name if file already exists.

Status: Completed

Available in LabVIEW 2015 and later with the 'Create File with Incrementing Suffix' VI.

On downloading a file from internet and if the file already exists (file with the same name), it automatically appends an auto-incrementing number to the file name, wouldn't be it nice to have the similar feature (may be optional) with Open/Create/Replace File Function.

 

Append with auto incrementing number in the file name

 

 

Consider the scenario, you've enabled this option ('append number if file already exists' as shown in above figure) while using Open/Create/Replace File Function and operation input is 'create' and name of the file is MyFile.txt, which already exists then this fuction should create a new file with name MyFile (1).txt (or may be MyFile (2).txt if MyFile (1).txt also exists and so on).


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


11 Comments
ngc6193
Member

I implemented the original VI code in my LV2014 install, works great! Well.... okay a couple of minor speed bumps for me, cannot have empty spaces in file name, need to have leading zeroes, and if a file name has an "_01" already in it when I first start running the tool, it adds another _01 on the end leaving the original _01 intact. We need the leading zero's for sorting correctly. Then when I do "_0%d" it keeps the leading zero there and it never increments when 09 is incremented, instead we get _010. Otherwise, it works great. ---Bill