Showing results for 
Search instead for 
Did you mean: 

Find newest file in directory and delete after 10 files

Go to solution


i want to create a vi that can do two things

1. Input: 1. Directory 2. Number

2. Output: newest file in the specified directory

3. Delete all old files if number is two big, so if number = 2 then only keep two newest files in the directory and delete the rest


How can i do this? I cant find andy function to get the date of a file?


Thanks for your help

0 Kudos
Message 1 of 6

By "date of file" do you mean the date it was created or the date is was modified?


- Matt

0 Kudos
Message 2 of 6
The File/Directory Info function returns the last date modified, if that's what you're looking for.
0 Kudos
Message 3 of 6

Hi OnlyOne,

see this link for an example.



0 Kudos
Message 4 of 6
Accepted by OnlyOne


Labview has a function called "File/Directory Info" this will give you the date for last modification. This may not be the same as date created. This function is used in a cool example called "\Listbox for File Explorer" find it with example finder. But as I said the modification data and creation date may not be the same. So I made something using the dir command and system exe function. Much better I think. The dir command is documented here The result is in the VI  enclosed. You may have to modify it, to fit you need


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
Message 5 of 6

Hi t06afre,

thanks for the great example. Works perfect.

0 Kudos
Message 6 of 6