Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get all folders name and save it

Hello qlikers :),

I want to get all folder names from a path and save it in a table and store it.

Please see the code what my idea is. How could I do that?

It should get all folders from the path vRoot and wirte it in a table and store it, after finishing. 

SET vRoot = ['lib://Try/Folder'];
sub GetQVDFIleNames(Root)
 
 	BackupFile:
   		LOAD * INLINE [
   			ApplicationName, ID
   		];
   for each SubDirectory in dirlist( Root & '\*' )
  		LOAD * INLINE [
   			ApplicationName, ID
   		];
             Resident BackupFile;

    next SubDirectory

end sub

Call GetQVDFIleNames($(vRoot)) ;

Thank you in advance!! Looking forward to reading some answers 🙂

 

Labels (1)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

sub GetQVDFIleNames(Root)

  	for each SubDirectory in dirlist( Root & '\*' )
    
      let vFileName = SubField('$(SubDirectory)', '/', -1);
        FileList:
            Load
            '$(vFileName)' as [ApplicationName],
            '0' as [Backup]
            Autogenerate(1);      
    next SubDirectory
	Store FileList into $(vBackupFilePath)_NEW.csv (txt);
end sub

Call GetQVDFIleNames($(vRoot)) ;

View solution in original post

1 Reply
Anonymous
Not applicable
Author

sub GetQVDFIleNames(Root)

  	for each SubDirectory in dirlist( Root & '\*' )
    
      let vFileName = SubField('$(SubDirectory)', '/', -1);
        FileList:
            Load
            '$(vFileName)' as [ApplicationName],
            '0' as [Backup]
            Autogenerate(1);      
    next SubDirectory
	Store FileList into $(vBackupFilePath)_NEW.csv (txt);
end sub

Call GetQVDFIleNames($(vRoot)) ;