LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Recently Modified Files

Solved!
Go to solution

I need to create a list of recently modified files from a given folder on local net.  The folder contains thousands of files in hundreds subfolders.

The conventional method (attached) take way too long.  ~40 secs in office, > 5 min at home (with VPN).

I can do better with command prompt.  ~20 secs in office

Window Explorer (manually) can do it in ~5 sec  in office,  < 20 sec at home.

 

Anyone got a better solution ?

 

snippets.png

 

 

George Zou
0 Kudos
Message 1 of 9
(4,187 Views)

I don't know if it's better, but here's .NET solution:

listfiles.png

 

It's about 3x faster than native LabVIEW on my machine (listing files using DirectoryInfo rather than native Recursive File List.vi looks much more efficient). I didn't test it thoroughly, so you might want to play a bit with FileInfo properties (there are UTC versions of timestamps). Or you might just get file name from FileInfo and then native File/Directory Info as in your code.

 

Here's documentation on DirectoryInfo class: https://msdn.microsoft.com/en-us/library/system.io.directoryinfo_methods(v=vs.110).aspx

 

Message 2 of 9
(4,136 Views)

Thanks.

It's much faster to use .net to retrieve files.  19 sec.

 

George Zou
0 Kudos
Message 3 of 9
(4,121 Views)

~60 sec at home.

 

 

George Zou
0 Kudos
Message 4 of 9
(4,115 Views)

@PiDi wrote:

I didn't test it thoroughly,


I know it's a quickie (and that OP and you know this), but close those refs!

 

It will leak memory (at 10 MB\sec. on my PC) when used in production code if you don't.

large.png

Message 5 of 9
(4,092 Views)
Solution
Accepted by topic author zou

Have you tried with the System Exec.vi?

Get Modified After Files System Exec.png

Ben64

Message 6 of 9
(4,075 Views)

Yes. I did try this yesterday.  But in a batch file.  Have to connect to the local net first.  Windows mapping not recognized by command prompt.

 

The test result was ~ 5 sec in office, and ~20 sec at home.

 

George Zou
0 Kudos
Message 7 of 9
(4,068 Views)

@ben64 wrote:

Have you tried with the System Exec.vi?


He did mention that ("I can do better with command prompt"), but it's a nice reference anyway! I can imagine most people will simply list all files and then parse the dates, but this must be way more efficient.

0 Kudos
Message 8 of 9
(4,064 Views)

Here is my batch file:

PUSHD \\local network path
FORFILES /M *.xlsx /S /D +2017-09-19 /C "cmd /c echo @path @fdate" > %USERPROFILE%\Desktop\list.txt
POPD

George Zou
0 Kudos
Message 9 of 9
(4,063 Views)