ni.com checkout is currently experiencing issues.

Support teams are actively working on the resolution.

Example Code

Find The Most Recent File in a Folder of Files Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Download All

Overview

This VI takes in a listing of files from a folder path, finds out all the files in the folder, and returns the path to the most recent file.

 

Description

Finding the most recent file in the specified folder can be challenging and needed for some applications. Thanks to this example, a user can get the most recent file programmatically.

 

Requirements

Software:

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

1. Select folder for searching most recent file.
2. Run VI.
3. Observe most recent file at File Path Out indicator

 

Additional Information or References

2012.png



 

 

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

 

 

Jeff | LabVIEW Software Engineer

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

Comments
rivand
Member
Member
on

Check the List Folder VI.

Jayberns1919
Member
Member
on

This vi returns a folder not a file..?

James_W
Active Participant
Active Participant
on

The issue with this is it returns files in modification date, and if someone opens a file after it is created it will affect the last modified date used by this function - better to put an ISO 8601 timestamp in the filename! - safer long term from manual intervention.

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed