Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Copying file from Server to different location

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

1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

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

View solution in original post

6 Replies
Frank_Hartmann
Master II
Master II

Your second macro works fine.

Did you setup your module like this:

Unbenannt.png

Not applicable
Author

Hi Hartmann

Thanks. How can I call it in script?

Frank_Hartmann
Master II
Master II

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

Not applicable
Author

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?

Frank_Hartmann
Master II
Master II

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

Not applicable
Author

Hi Frank

First of all apologies for calling you by family name. It worked. Thanks heaps for your help.