From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

list all files in a directory in order of timestamp

have files from directory displayed in an array of columns,using the list icon. however i would like them to be in order of aquisition or timestamp, rather then all 1, 10ns 20s etc.
is there anyway to control the indexing with time stamping order?
0 Kudos
Message 1 of 4
(10,209 Views)
LabVIEW allows you to sort just about anything. All you have to do is create a cluster containing everything you want for a "record" and make an array of those clusters. In your case, you want to cluster the file name with its time stamp (how about last modification date?). The sort function (we call them functions or VIs, not icons) will order your array based on the order in which you clustered your elements.

I whipped up a tiny example. Give it a directory path and run it. The output is a list of the filed in that folder sorted according to their time stamp.

If you have some clear specifications for your whole application, consider hiring an Alliance Member (like us). You will end up with a most professional example of LabVIEW code t
o learn from and tweak as you like.

Alliance Members are here to help. We do this stuff every day.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
Message 2 of 4
(10,209 Views)
Loop over each file
--- Use the FILE/DIRECTORY INFO function to get the MOD DATE of each file.
--- Bundle the MOD DATE with the path, or whatever else you need about the file.
--- Make sure the MOD DATE is FIRST in the cluster.
--- Use auto-indexing to make an array of these clusters.

When the loop is done, run the array of clusters through the SORT 1-D ARRAY function.

Now they are sorted in increasing order (oldest first).
Reverse that array if you need youngest first.

DO what you need to with the sorted array.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 3 of 4
(10,209 Views)
ty for your help, this was exactly what I needed
0 Kudos
Message 4 of 4
(10,209 Views)