Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
we have a issue in inability to see Log files as Server is managed by different team and it is difficult to get Log files from server. I was thinking of copying Log files from Server to NAS drive in my access. Server read data from this NAS hence it should have access.
Based on another forum I wrote following code which was working fine for the discussion poster. Unfortunately doesn't work for me:
sub ProcLogMove
Set vExec = "C:\IBM\1.qvw.log" "C:\IBM\1\1.qvw.log";
execute cmd.exe /C xcopy $(vExec) /Y;
End Sub
From further read it looks like execute command requires changes in settings.ini which is not possible.. so may not be the right solution for me. Anything else that I can use to copy log file using Qlik script with no other changes in server side?
I also tried following code in script and Macro window but it failed to do anything
Sub LogMove
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "C:\IBM\1.qvw.log", "C:\IBM\1\1.qvw.log"
End Sub
I did not receive any error in log file. Sorry if I am talking too dumb as I am new to Qlik.
Thanks
not sure if this helps, but try to call the function like this:
Script:
let vlog = LogMove();
Module:
Function LogMove
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "C:\Users\Admin\Desktop\log.log", "C:\Users\Admin\Desktop\Neuer Ordner (2)\log.log"
End Function
Your second macro works fine.
Did you setup your module like this:
Hi Hartmann
Thanks. How can I call it in script?
You will need to make a function like this:
Function LogMove
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "C:\IBM\1.qvw.log", "C:\IBM\1\1.qvw.log"
End Function
Then you are able to call the function in script!
hope this helps
Hi Hartmann,
Thanks. I created macro and tried calling that macro function in script using Call functionName; though when called it ask for permission to execute system access command. At server it is all automated so no manual intervention possible to click on button and accept risk. We can not modify any server ini files as well. What is the way to handle this?
not sure if this helps, but try to call the function like this:
Script:
let vlog = LogMove();
Module:
Function LogMove
dim fso
set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "C:\Users\Admin\Desktop\log.log", "C:\Users\Admin\Desktop\Neuer Ordner (2)\log.log"
End Function
Hi Frank
First of all apologies for calling you by family name. It worked. Thanks heaps for your help.