PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Recursive Directory Scan to Populate a Table
Recursive Directory Scan to Populate a Table
Iniciado por guest, 22,nov. 2016 17:40 - 3 respuestas
Publicado el 22,noviembre 2016 - 17:40
I'm looking for the most efficient way to populate a table (fields being filename, file extension, file size, creation date) from a directory that contains subfolders - the user would decide what file extension(s) they want added to the table.

In other languages, functions that scan a directory tree typically populate an array - WinDev appears to build a string. My first concern is the string length - one sample folder contains > 7000 potential files matching the search criteria. The second concern is how best to add only files that match the file extension criteria - is it better to scan for everything and filter out the undesirable files when adding records to the table or is it more efficient to weed out the undesirable files during the recursive scan?
Publicado el 22,noviembre 2016 - 18:29
Hi Scott

flistfile in recursive mode with the extension filter for your files is the fastest way.
I doubt that your string will be bigger than 2 GB, so you should be ok.

If you are not, you can use the alternate syntax, where a procedure is called for each file (slower)

Best regards
Publicado el 22,noviembre 2016 - 18:33
Hi Fabrice - its great to hear from you (I still visit your web site from time to time ). I didn't know that WinDev could have a string up to 2GB in size - that is huge!

Can I pass a list of file extensions to fListFile that I want added to it's output string (e.g. *.Bmp;*.Jpg) and exclude everything else, or do I need to compare each CR delimited element for the desired file extension (which sounds like it might be less efficient or run slower)?
Publicado el 22,noviembre 2016 - 21:37
Hi again

you can get all bmp files, but not all bmp AND jog in ONE call. IN that
case, you'll need to ask for ALL files and discards the one you don't
want. fExtractpath is very easy to use for that

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 11/22/2016 à 12:33 PM, Scott Daughtry a écrit :
Hi Fabrice - its great to hear from you (I still visit your web site
from time to time ). I didn't know that WinDev could have a string up to
2GB in size - that is huge!

Can I pass a list of file extensions to fListFile that I want added to
it's output string (e.g. *.Bmp;*.Jpg) and exclude everything else, or do
I need to compare each CR delimited element for the desired file
extension (which sounds like it might be less efficient or run slower)?