Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

michaelk
Not applicable

Rapid directory/file scan

Hi there,

I have to scan a directory with subfolders for each day of the year, containing up to around 400 files. So this will generate more than 10000 files each month. I tried a script using the code sequence "For each ... in ... ". That works very fine, but with very low speed (several hours). Is there a more rapid way e.g. using a macro and system functions to speed up the process. The goal is, to generate a list of files with the complete path, so that I can sort out the ones, for loading the complete data from the files.

Thanks a lot

Michael

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Not applicable

Re: Rapid directory/file scan

Something like this will get you a table with the full file paths:

execute cmd.exe /c dir /s /b d:\qvdata > myfilelist.txt;

LOAD @1 as Filename

FROM

myfilelist.txt

(txt, codepage is 1252, no labels, delimiter is ';');

You can use the subfield and./or index functions to get the directory and file names.


talk is cheap, supply exceeds demand
2 Replies
Gysbert_Wassenaar
Not applicable

Re: Rapid directory/file scan

Something like this will get you a table with the full file paths:

execute cmd.exe /c dir /s /b d:\qvdata > myfilelist.txt;

LOAD @1 as Filename

FROM

myfilelist.txt

(txt, codepage is 1252, no labels, delimiter is ';');

You can use the subfield and./or index functions to get the directory and file names.


talk is cheap, supply exceeds demand
michaelk
Not applicable

Re: Rapid directory/file scan

Hi Gysbert,

your idea makes the difference. It only took around 6 minutes to create a filellist with more than 900000 entries. Thanks a lot for that.

Michael