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
moderator1983
Active Participant

Illustration:

 

Illustration


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

 Make your LabVIEW experience more CONVENIENT.


crossrulz
Knight of NI

Absolutely!  I have had to program this up so many times and it would be so nice if that primitive could just do it for me.

 

Another option would be to edit the operation enum instead of the extra input.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AristosQueue (NI)
NI Employee (retired)

I think this is a bad thing to put on the primitive. But shipping another VI that did this seems reasonable.

 

The problem with putting it on the primitive is that any numbering scheme we picked would not meet someone's needs. You want a simple integer. Someone else may want a timedate stamp. Someone else may want a number at the start of the filename. And so on.

 

Providing a VI that did this that satisified some folks but that others could use as a "Save As" to make their own seems like a much much better approach.

AristosQueue (NI)
NI Employee (retired)

Another pretty big reason not to put this on the primitive -- it doesn't make any sense when opening a file for Read. Adding this to the prim direct would inject a new error case into a primitive. And the whole "create/replace" enum is also meaningless for this operation.

Intaris
Proven Zealot

Agreed, an extra VI but NOT a modification of the primitive.

crossrulz
Knight of NI

AristosQueue wrote:

And the whole "create/replace" enum is also meaningless for this operation.


That's why I suggested editing the enum to add the option to the enum instead of another input.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
AristosQueue (NI)
NI Employee (retired)

> That's why I suggested editing the enum to add the option to the enum instead of another input.

 

I saw that later. 🙂

AristosQueue (NI)
NI Employee (retired)

I posted a VI to solve this and have added this to the list of VIs to be considered for a future LabVIEW release.

http://forums.ni.com/t5/LabVIEW/A-helpful-VI-to-create-a-new-file-without-colliding-with/m-p/2818966...

Shinton
Member

I like this idea and agree with crossruiz's implementation of an additional enum item.  It makes more sense that way, as already noted, and the VI's input parameters are already getting a little too numerous so adding more would also add to the mess.

Darren
Proven Zealot
Status changed to: Completed

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