Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
khan_imran
Creator II
Creator II

Issue with File Size function

Hello All,

I am using File size function to remove file where no data available and it only contain error message. I have one folder which consist of many file with similar name and date of a file(as mentioned below).

SalesData20160401

SalesData20160402

SalesData20160403 and so on,

There are few files which does not contain niether data nor header. I am trying to load all the files from a particular folder (as stated below) and want to exclude file for which the size is below 10 KB.


D:\Data\SalesData\(files are stored under this path)

How can I exclude those file which are having a size of less than 10 KB?

Thanks,

Imran K

1 Reply
maxgro
MVP
MVP

maybe

for Each file in FileList('.\SalesData????????.txt')

        // change the load, this is for my test files

        tmp:

       First 1 LOAD

            @1,

            FileSize() as fs

       FROM

            $(file)

            (txt, codepage is 1252, no labels, delimiter is '\t', msq);

       let filesize = Peek('fs');

       DROP Table tmp;

       if('$(filesize)' > 10*1024) then

            trace ***** load file $(file) filesize=$(filesize);

       else

            trace ***** dont load file $(file) filesize=$(filesize);

       endif

next