1 Reply Latest reply: Feb 27, 2014 9:48 AM by Marcus Sommer RSS

    SubFolder Parsing

    Jerry Helms

      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?

        • Re: SubFolder Parsing
          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