Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
datanibbler
Champion
Champion

Assembling a list of filenames

Hi,

I have made a copy of a directory on the server containing about 45.000 files, most in jpg format, some different and I want to run a script to loop over all these and just record the filename for once - I will go from there.

For some reason, the code I have doesn't work - it looped over all the files, I could watch it in the progress_window - but I see only BLANKs in a listbox.

The code is like this

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

// Zunächst laden wir eine kleine Dummy-Tabelle
Dateinamen:
FIRST 1
LOAD
' '
as Dateiname_alt
RESIDENT Fin_Bew
;
 
DIRECTORY 'C:\Users\friedrich.hofmann\Documents\QS_IdentBilder\Sicherungskopien_20160126\';
 
FOR EACH File in FileList('*')
Concatenate (Dateinamen)
FIRST 1 LOAD '$(file)' as Dateiname_alt AutoGenerate 1;
NEXT File
 
STORE Dateinamen INTO 'C:\Users\friedrich.hofmann\Documents\QS_IdentBilder\Metadaten\Gesamtliste\Alle_alle.qvd';

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

So I loaded a small dummy_file to concatenate to in each iteration of the loop - so I have one record too much, I can get rid of that lateron - and then I start the loop and for every file I encounter, I just want to load the file_name_and_path.

Can anyone help me find out why this isn't working?

Thanks a lot!

Best regards,

DataNibbler

20 Replies
datanibbler
Champion
Champion
Author

Yippieh!

It works now - so I can finally start.

I decided to start that whole task over because after I have worked on it on and off with long intervals inbetween, I don't remember exactly what I did. Now I hope that I'll have no more problems with the command-line stuff skipping files - I guess that was the LOWER() I had built into the LOAD before, or maybe I need a SLEEP statement in the loop.

Let's see ...