Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

counting no of files present in folder

Hi all,

am loading all files having same format from folder for that purpose i need to count no files present in folder

is their any way Count files having same format also;;

Thanks  in advance

6 Replies
datanibbler
Champion
Champion

Hi qliklearn,

have a look at the QlikView_functions FILEBASENAME/ FILENAME and FILEEXTENSION and FILEDIR (there are more).

These should enable you to count the nr. of files in a directory that have the same extension.

HTH

Best regards,

DataNibbler

Not applicable
Author

It is perhaps not needed if they have the same name or same extension:

to read all XLS: LOAD .... FROM '*.xls'

You can use also FilelIst (string) to loop over the files and do an explicit loop

Fabrice

manojkulkarni
Partner - Specialist II
Partner - Specialist II

check below code to count the files & as well file names.

FOR Each File in FileList('$(vFilePath)')

  FileList:

  LOAD

  '$(File)' as Name,

  FileTime( '$(File)' ) as FileTime,

autogenerate 1;

NEXT

Let vCountFileList = NoOfRows('FileList');

manojkulkarni
Partner - Specialist II
Partner - Specialist II

check below code to count the files & as well file names.

FOR Each File in FileList('$(vFilePath)')

  FileList:

  LOAD

  '$(File)' as Name,

  FileTime( '$(File)' ) as FileTime,

autogenerate 1;

NEXT

Let vCountFileList = NoOfRows('FileList');

Not applicable
Author

plz find Attch ment

SET vpath ='E:\SSIS\multiple\';

SET vFilePath = 'E:\SSIS\multiple\Data1.xlsx';

FOR Each File in FileList('$(vpath)')

  FileList:

  LOAD

  '$(File)' as Name,

  FileTime( '$(File)' ) as FileTime,

autogenerate 1;

NEXT

Let vCount = NoOfRows('FileList');

i have done like this please check what is wrong it not counting values

manojkulkarni
Partner - Specialist II
Partner - Specialist II

working code ...

SET vpath ='C:\Users\Manoj\excel\*.*';

FOR Each File in FileList('$(vpath)')

  FileList:

  LOAD

  '$(File)' as Name,

  FileTime( '$(File)' ) as FileTime

autogenerate 1;

NEXT

Let vCount = NoOfRows('FileList');