Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
userid128223
Creator
Creator

file timestamp without reading full file data

Hi Everyone

I am trying to read all files from a directory and get their filename & File time stamp. It works fine with below script however it reads the whole file. some of my files are huge 5gb+ and I don't want script to read full data inside the file, i am only interested in filename & timestamp and not what is inside of the file. 

test:
 Load filebasename() as temp_filename,
FileTime() as temp_filetime
 FROM [lib://distribution_files/*];

 

2 Replies
MayilVahanan

Hi @userid128223 

You can try like below..

1. WHERE(RowNo() < 1 );

Or

2. Where 1=0;

Or

3. First 1 Load filebasename() as temp_filename,

FileTime() as temp_filetime
 FROM your source;

Either of 3 option, will help you.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
marcus_sommer

You don't need to load the files at all else you could loop through the folder and fetching the OS information directly. It means something like this:

for each file in filelist('lib://distribution_files/*')
   files: load filetime('$(file)') as FileTime, subfield('$(file)', '\', -1) as File autogenerate 1;
next

If you looked in the help or the community by for each or filelist you will find various examples of the approach.

- Marcus