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