Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get a list of files

Hello! So I want  to get all the files from a directory in Qlik Sense Desktop.

Found a nice post on the forum

Set vConcatenate = ;

FileList:

LOAD

'' AS SourceFile

AUTOGENERATE 0;

sub ScanFolder(Root)

          for each FileExtension in 'qvw'

                    for each FoundFile in filelist(Root & '\*.' & FileExtension)

                              FileList:

                              LOAD '$(FoundFile)' as SourceFile

       AUTOGENERATE 1;

                            

                              Set vConcatenate = Concatenate;

                    next FoundFile

          next FileExtension

          for each SubDirectory in dirlist( Root & '\*' )

                    call ScanFolder(SubDirectory)

          next SubDirectory

end sub

Call ScanFolder('C:\Users\Public\Pictures\Sample Pictures\') ;


But It's not working. The FoundFile variable is always null. I've tried with different methods and I get Null every time.

There is another example on this page Attribute ‒ Qlik Sense

But those are not working either.

What is wrong?

12 Replies
Anonymous
Not applicable
Author

Any idea of why it's not working without a connection?

rittermd
Master
Master

I just tried the same code with the location hard coded and it worked.

call DoDir ('D:\Dev\External Data')

//call DoDir ('lib://External_Data')

Andrea_Ghirardello

The suggestion was to think at the regular expressions approach...

The script doesn't contain any detail or useful info in that case and trying it out doesn't require the source files.

In this specific case, in order to use the regular expressions there's a macro in the document...that obviously you can't use in Sense.

Anyway, if you found a solution that solves your issue...go that way.

Br,

Andrea