Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Tyler_Waterfall
Employee
Employee

Validate UNC path (root folder) in load script?

Hello,

I need to write a simple check in the QVW load script to validate that a user-defined folder path is valid. Currently, I am using a FileTime('$(userFilePath)') function, which works fine unless the File Path enetered is a UNC root folder. There is no FileTime for a UNC root!

Are there any functions or methods to accurately verify the existence of a user-defined folder where that folder might be a UNC root?

Thank you! Gracias!

8 Replies
Gysbert_Wassenaar

Well, you could try a store command to try to write a file to that folder and then check if the file exists by gettting its filetime.


talk is cheap, supply exceeds demand
Tyler_Waterfall
Employee
Employee
Author

Gysbert,

Thank you for your quick response. That thought crossed my mind as well, but I am concerned that such a store command would also require Write access to the specified folder, which might be restricted.

Gysbert_Wassenaar

Ok, maybe using the execute command then.

execute cmd.exe /c dir  $(userFilePath) > dircheck.txt

Afterwards load dircheck.txt and check its contents. The execute will need some additional priviliges I reckon.

Who knows, it might even work


talk is cheap, supply exceeds demand
Tyler_Waterfall
Employee
Employee
Author

I wish I could use the execute command (it does work) - but that requires the user to allow EXECUTE from the load script - a security setting that we don't want users to tinker with.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

can you asume that the folder will always have at least one file? If so, you can do something like this:

SET vFolderExists=0;

for each file in filelist('\\rob-work2\c$\*.*')

          SET vFolderExists=1;

          EXIT FOR WHEN 1;

next file

SET file=;

-Rob

Tyler_Waterfall
Employee
Employee
Author

Rob - thank you. this is helpful, especially when combined with a dirlist loop for the case when we're not certain whether a file will exist in the UNC share.

Tyler_Waterfall
Employee
Employee
Author

Gysbert,

I am hesitant to use anything that would require write access to a folder, which the Store command would. I'm not sure I could detect why the script was failing - whether for permissions or for the non-existence of the specified folder.

Thanks!

Tyler_Waterfall
Employee
Employee
Author

Rob and community,

I'm still unable to get a file or a directory to return when using filelist or dirlist, respectively, on a UNC Root.

Tricky, tricky.

Any other ideas? (which do not require write-access for the process running the script)

Thank you!

Tyler