annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

Get Recently Modified Files

Risolto!
Vai alla soluzione

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
Messaggio 1 di 9
5.220Visualizzazioni

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

 

Messaggio 2 di 9
5.169Visualizzazioni

Thanks.

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

 

George Zou
0 Kudos
Messaggio 3 di 9
5.154Visualizzazioni

~60 sec at home.

 

 

George Zou
0 Kudos
Messaggio 4 di 9
5.148Visualizzazioni

@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

Messaggio 5 di 9
5.125Visualizzazioni
Soluzione
Accettato da autore argomento zou

Have you tried with the System Exec.vi?

Get Modified After Files System Exec.png

Ben64

Messaggio 6 di 9
5.108Visualizzazioni

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
Messaggio 7 di 9
5.101Visualizzazioni

@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
Messaggio 8 di 9
5.097Visualizzazioni

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
Messaggio 9 di 9
5.096Visualizzazioni