09-26-2017 11:47 AM
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 ?
Solved! Go to Solution.
09-26-2017 04:33 PM - edited 09-26-2017 04:35 PM
I don't know if it's better, but here's .NET solution:
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
09-26-2017 05:05 PM
Thanks.
It's much faster to use .net to retrieve files. 19 sec.
09-26-2017 07:01 PM
~60 sec at home.
09-27-2017 03:42 AM
@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.
09-27-2017 09:36 AM
09-27-2017 09:41 AM
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.
09-27-2017 09:44 AM
@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.
09-27-2017 09:45 AM - edited 09-27-2017 09:59 AM
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