Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

jerryhnc
New Contributor III

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

Re: SubFolder Parsing

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

Community Browser