Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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/*];
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.
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