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: 
Anonymous
Not applicable

SubFolder Parsing

I have seen several posts in the forum about using the For Each File in FileList paradigm to retrieve subfolder names.  However, I think most of the examples I have seen are parsing for a known number of subfolder hierarchy levels and consistency in the number of levels.   I have an application with an unknown number of hierarchy levels and inconsistency between subfolders.

c:\Root\

     SubLevel1

          NextLevel1A

               NextLevel1A-A

                    abc.csv

                    def.csv

          NextLevel1B

               xyz.csv

     SubLevel2

          NextLevel2A

               123,csv

         

Any suggestions for recursion to the lowest level?

1 Reply
marcus_sommer

See this example from help:

subListeGenerieren (Basis)

foreach Erweiterung in 'qvw', 'qva', 'qvo', 'qvs'

foreach Datei in filelist (Basis&' \*.' &Erweiterung)

LOAD '$(Datei)' AS Name, FileSize( '$(Datei)' ) AS

Größe, FileTime( '$(Datei)' ) AS DateiZeit

AUTOGENERATE 1;

next Datei

next Erweiterung

foreach Verzeichnis in dirlist (Basis&' \*' )

callListeGenerieren (Verzeichnis)

next Verzeichnis

endsub

callListeGenerieren ('C:')

- Marcus