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: 

Read all files in a directory

That's actually not a bad idea, although I don't know if you can subtract 2 time stamps. What I need right now, is a way to go through the files again after it has finished reading the files the first time.

0 Kudos
Message 11 of 16
(661 Views)

@Nando88 wrote:

That's actually not a bad idea, although I don't know if you can subtract 2 time stamps. What I need right now, is a way to go through the files again after it has finished reading the files the first time.


You get a double representing fractional seconds.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 16
(650 Views)

How can I make the read files in a directory loop for the files again after it has finished reading all the files in the directory?

How can I make the 2 time stamps match, so that the condition is met?

Thanks in advance!

0 Kudos
Message 13 of 16
(644 Views)

If you get an array of the last mod timestamps, you can use Sort 1D array to find the newest file.  Save that timestamp in a shift register. If the newest timestamp from the current array is greater than the save timestamp, then you have a new file. I think this might meet your needs better than trying to compare to the current time.  It could also be easily modified to identify multiple files which have been created since the previous check. The equality with current time cannot do that.

 

Lynn

0 Kudos
Message 14 of 16
(637 Views)

I'm trying to do something similar, but am using LV 2011, and I can't open these VIs. Unless there's a tool incompatible with 2011, could someone send me the equivalent VI in 2011?

0 Kudos
Message 15 of 16
(525 Views)

Personally, I would not loop though the entire file directory again once it's completed.

 

Have a look at the FileSystemWater Class in .NET. It will let the program know a file was added or removed in a specific directory. I've never used it before, but it should eliminate unecesarry iterations. The only reason I knew about this was I was browsing through the forms and seen a request to know when something in a directiory changed.

 

https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx

0 Kudos
Message 16 of 16
(510 Views)