LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read the latest created file ?

Comment je peux avoir le nom du fichier le plus récent (ayant la date de modification la plus récente) ?

 

How can i get the name of the latest created or modified text file ?

 

Thx for help.

0 Kudos
Message 1 of 9
(2,768 Views)

Hi Nizartun,

 

You can use file/directory info VI.

 

Regards,

Bijay

 

0 Kudos
Message 2 of 9
(2,766 Views)

@Bijay wrote:

Hi Nizartun,

 

You can use file/directory info VI.

 

Regards,

Bijay

 


To expand on that you can use List Folder for all files in the directory, then use a For loop with File/Directory VI and read the last modified date, looking for the newest file in the directory.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 3 of 9
(2,764 Views)

Hi all,

 

Yes thats right.

 

File1.png

Regards,

Bijay

0 Kudos
Message 4 of 9
(2,761 Views)

(BiJay: That will not work unless both folder paths are the same. It is a bad idea to have identical diagram costants scattered all over, because any change in code would need identical changes in several places, creating a maintenance headache and potentials for error.)

 

You need to wire the folder path from the outside to the inside of the loop. Then you also need to sort by modification date to get the newest file.

 

This assumes you only want *.txt files. Change the pattern if needed.

 

Here's a quick snippet.

 

Message 5 of 9
(2,755 Views)

Thx to all of you

0 Kudos
Message 6 of 9
(2,700 Views)

Hi altenbach,

Could you please post the vi file for this?

What is the block with a hour-glass, and also the block with a black arrow and the green word "path"?

Thank you.

0 Kudos
Message 7 of 9
(2,637 Views)

Bundle function and Unbundle by Name function.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Message 8 of 9
(2,611 Views)

splee wrote:

Could you please post the vi file for this?


The image in my post is actualy a LabVIEW snippet. You can simply drag it to the block diagram of LabVIEW 2011 and it will turn into fully functional code. Try it.

Message 9 of 9
(2,600 Views)