LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Auto increment for file names

Does anybody know if it is possible to have the 'Open/Create/Replace.vi to search for exsisting files with a specific pattern, like data001.txt, and automatically increment the name so a new file is created called data002.txt

Thanks
Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 1 of 4
(3,066 Views)
All things are possible

If you only need to deal with the simple filename type you use in the
example, feed the filename without the path into the "Scan from String" node
set up so you get a string, a three digit number and a string. Use the "+1"
increment node on the number, and use "Format Into String" to put the three
elements back together into the incremented filename.

eodickens wrote in message
news:50650000000800000068180000-984882144000@quiq.com...
> Does anybody know if it is possible to have the
> 'Open/Create/Replace.vi to search for exsisting files with a specific
> pattern, like data001.txt, and automatically increment the name so a
> new file is created called data002.txt
>
> Thanks
> Ed
0 Kudos
Message 2 of 4
(3,066 Views)
Just to add a little to the other response, you might want to use the List Directory.VI to find what files exist in a directory that match your pattern. You can for instance input data*.txt, and it will return a list of matching file names. You can then manipulate that list of file names to see what file should be next.
Message 3 of 4
(3,066 Views)
Thanks to both, between the two it looks like I'll be able to do what I want.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 4 of 4
(3,066 Views)