LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

replacing files & for-loops

Hallo,

I have a little problem with writing files, whose name is generated by a for-loop. Their names are mess0001.txt, mess0002.txt etc. At the end of the jiip the variable [i] falls back to 1 and the VI asks me if it can replace the file mess0001.txt. The new file and the overwritten file contain the same data. How can I prevent that?

I prefer something like: If file exists then exit program.

Arno
0 Kudos
Message 1 of 2
(2,455 Views)
Wire the desired path to "file info.vi" (advanced file palette) and wire the error cluster ot a case structure. If no error occurs, the file exists and you can exit. If an error occurs, continue.

You could also list the files (list directory.vi with e.g. pattern "mess*.txt"), extract the numbers from the list of file names and continue with a file name using "highest number+1").
0 Kudos
Message 2 of 2
(2,455 Views)