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: 
qlikviewforum
Creator II
Creator II

Scan file system in optimized way!

Hi All,

Is there is any optimized way to scan the file system other than using the below code which generates very large log file. Please help!

  

// list all QV related files on disk

sub DoDir (Root)
for each Ext in 'qvw', 'qva', 'qvo', 'qvs'
for each File in filelist (Root&' \*.' &Ext)
Load '$(File)' as Name, FileSize( '$(File)' ) as
Size, FileTime( '$(File)' ) as FileTime
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&' \*' )
call DoDir (Dir)
next Dir
end sub

10 Replies
Bill_Britt
Former Employee
Former Employee

Hi,

I would once you had everything working like it should, turn off the logs.

Bill

Bill - Principal Technical Support Engineer at Qlik
To help users find verified answers, please don't forget to use the "Accept as Solution" button on any posts that helped you resolve your problem or question.
qlikviewforum
Creator II
Creator II
Author

Hi Bill,

Thank you!

We do need logs to be saved for our investigation. So I would like to optimize it by doing some changes in the code and let it saves the log files in the normal way. If I can optimize it then that could be the best way to do it instead of thinking about how to off the logfile.

Though it will not be accepted, please let me know how to turn off the logs if everything it working file. I am not sure how to do that.

Thanks


DavidFoster1
Specialist
Specialist

isnt the end sub on the wrong line? Shouldn't it be on line 12?

DavidFoster1
Specialist
Specialist

document properties ->  general tab -> generate logfile flag

qlikviewforum
Creator II
Creator II
Author

No, it will be there only.

qlikviewforum
Creator II
Creator II
Author

I know this properties but is there is anyway where we can generate the log file only when the application fails. This is what my question was!

DavidFoster1
Specialist
Specialist

  1.    
  2. // list all QV related files on disk  
  3.  
  4. sub DoDir (Root)  
  5. for each Ext in 'qvw', 'qva', 'qvo', 'qvs'  
  6. for each File in filelist (Root&' \*.' &Ext)  
  7. Load '$(File)' as Name, FileSize( '$(File)' ) as  
  8. Size, FileTime( '$(File)' ) as FileTime  
  9. autogenerate 1;  
  10. next File  
  11. next Ext
  12. end sub

  13. // Loop through directory structure calling DoDir procedure

  14. for each Dir in dirlist (Root&' \*' )  
  15. call DoDir (Dir)  
  16. next Dir  

There is no way to avoid the logging as it is generated at the same time as the action. It is the individual load statements for each file that will be bloating the log file.

qlikviewforum
Creator II
Creator II
Author

Hi David,

Thank you for your response.

Is there is any way to restructure the code in better way to avoid logging and the time it takes to refresh.  Some how I need to restructure this code to avoid logging. If not possible to restructure the same piece of code we are ready to switch if the new code doesn't takes much time and have less logging.

I think oneway of optimizing this code is to scan only those files which we are looking for instead of scanning each and every file. For example if we looking for xls file in any of the directory code should be in a such a way that it scans only the xls file instead of scanning csv,jpg and etc...I agree it looks in only for xls file it creates the unnesscary logging if the directory contains other file format like csv,jpg and etc...

Please let me know if you have another alternative for this.

Thanks,

DavidFoster1
Specialist
Specialist

There is no way to simplify the code any further. I think to meet your requirements you will need to go back to looking at something like DIRUSE to extract the data and then load it into QlikView for analysis.