Handling multiple subfolders in a script

Depending upon the setup that you have to deal with, not all of your source data files may be in one folder. For example, a company may keep transaction files in a separate folder for each year and then one subfolder for each month.

This recipe gives an example of how to use DirList and FileList to retrieve files matching a particular filespec.

Getting ready

Load the following script:

Sub GetFiles(vPath) // Get a list of files with Q extensions For each vFile in FileList('$(vPath)\*.Q*') Files: Load '$(vPath)' as Folder, '$(vFile)' as File, FileSize('$(vFile)') As FileSize, FileTime('$(vFile)') As FileTime AutoGenerate(1); Next End Sub Sub GetSubFolders(vPath) For each vDir in DirList('$(vPath)\*') Folders: ...

Get QlikView for Developers Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.