Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlikers,
I need to filter a particular named txt files from the root folder (including all sub folders in it). I'm using the following sub routine and then filtering the sub routine result set to achieve the desired result.
sub ScanFolder(Root)
for each FileExtension in 'txt'
for each FoundFile in filelist( Root & '\*.' & FileExtension)
FileList:
LOAD '$(FoundFile)' as SourceFile,
FileTime( '$(FoundFile)' ) as Filetime
AUTOGENERATE 1;
Set vConcatenate = Concatenate;
next FoundFile
next FileExtension
for each SubDirectory in dirlist( Root & '\*' )
call ScanFolder(SubDirectory)
next SubDirectory
end sub;
Call ScanFolder ('myfolder\Log');
FinalFileList:
NOCONCATENATE
LOAD
SourceFile,
Filetime
RESIDENT FileList
WHERE SourceFile LIKE '*Reload_Task_Check';
My question is it is possible to filter the name of the txt file inside the subroutine itself? Can you please help me here.
Thanks,
Shan S
Try this:
...
for each FoundFile in filelist( Root & '\*.' & FileExtension)
if '$(FoundFile)' = 'xxx' then
...
else
...
end if
next
...
- Marcus
Try this:
...
for each FoundFile in filelist( Root & '\*.' & FileExtension)
if '$(FoundFile)' = 'xxx' then
...
else
...
end if
next
...
- Marcus
or add the known part of the file name to look for to the wildcard specification in your inner for loop. Like
for each FoundFile in filelist( Root & '\*Reload_Task_Check.' & FileExtension)
:
I have included IF condition and it works fine.
Thanks,
Shan S