Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
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