Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
can someone help me with script to know whether the directory is empty or not
my requirement is lo load only if the directory is empty.
You could run a loop with filelist() over your directory and if filesize() or maybe an own counter is 0 then the directory is empty or contained not the searched files. A good description of them could you find within the help by "for each ..." and also here: Loops in the Script.
- Marcus
Hi Pavan
Below script works for me. I hope it will work for you as well. Please try.
SET vPathQvd = 'D:\Girirajsinh\temp\*';
TempTable:
load
count(distinct FileName()) as FN
From [$(vPathQvd)] (biff, embedded labels, table is Sheet1$);
Let vCNT=Peek('FN');
if cnt>0
EXIT SCRIPT;
ELSE
// Wrie here your LOAD
ENDIF
Try below
Let vFileCount = 0;
For Each vFile in FileList('C:\Users\Vini\Downloads\*')
Let vFileCount = $(vFileCount) + 1;
Next
IF $(vFileCount) = 0 THEN
//Your Script
End IF
Thank u Vineeth ur code worked for my requirement.
Glad to help,
If your query is resolved please close the thread by marking response as correct
Qlik Community Tip: Marking Replies as Correct or Helpful