Example Code

LabVIEW - Dynamically Build File Path

Code and Documents


This is a simple example which shows how we can use the File I/O functions to build utilities which will dynamically build file paths based upon existing files.


The file path in this example is of the form "YY-MMM-DD Filename XXX" - this will auto-increment depending upon the files which already exist on disk and the current date. This is very useful when running repeated tests.

Please note that this is a simple example of utilising the File I/O functions and is not fully tested.



  • LabVIEW 2012 (or compatible)

Steps to Implement or Execute Code

  • Open the LabVIEW Project
  • Navigate to "Example - Create Directory and File Path.vi"
  • Configure File Setting and run (Run button or ctrl-R)
  • Create files and view generated paths (do this multiple times to see numbers increment)
  • Delete files to remove files and be able to generate from *000.* again
  • Select stop (or close the window) to stop the program (deleting or keeping the files)


Additional Information or References
VI Block Diagram of "Create Directory and File Path.vi"

 Block Diagram.png


 **This document has been updated to meet the current required format for the NI Code Exchange.**



Peter D

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.