Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All!
I hope this is the right forum for my question.
Im receiving daily files to a folder. I load these files and then want to move them from the "in files"-folder to the "out files"-folder. The script loads fine and even moves the files. But, the script never ends. It just freezes on the "Script Execution Progress" window. I can see that everything is executed but I have to Abort to proceed. I run Windows Server 2008 R2 and QlikView 11.20.12123.0 SR4 64-bit Edition (x64).
This is my script:
Table:
Load *
From
$(vPath_infiles)\*.txt
(txt, codepage is 1252, no labels, delimiter is '\t', msq);
EXECUTE cmd.exe /C move $(vPath_infiles)\*.txt $(vPath_outfiles);
(I also tried to "xcopy" from "in files" folder to "out files" folder and then do a "del" with no luck. Same error.)
Any suggestions are appreciated!
Br
cristian
Hi,
Instead of giving this in script, try this in a macro
Press ctrl +m and paste your macro there
Sub CopyFile
strFilePath = "x:\orig_file.txt"
strDestination ="x:\newpath\dest_file.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFileCopy = objFSO.GetFile(strFilePath)
objFileCopy.Copy (strDestination)
objFileCopy.Delete
End Sub
Document Properties -> Triggers -> Document Event Triggers -> Post Reload Triggers -> Add Actions -> Add -> External -> Run Macro -> Give your macro name here.
Check this for file operations
Hope this helps you.
Regards,
Jagan.
Hi Cristian,
1. Are you sure you check "Close when scirpt ends" check box in Script Execution window ?
2. If yes, without the cmd.exe command is the window closed after finishing script?
3. If yes, instead of move, try following commands
cmd.exe /C REN Path\infile Path\infile_old;
cmd.exe /C MOVE Path\infile_old Outfile;
Hi!
Thank you for the suggestions but doing
cmd.exe /C REN Path\infile Path\infile_old;
cmd.exe /C MOVE Path\infile_old Outfile;
Dont work....
Regarding the macro Im not allowed to run macros...
Other suggestions?
....and..
1 - Yes
2 - Yes
....wrong...
2 - NO. It seems that the window dont close after finishing the script. the EXECUTE commande dont seem to be the error....
I do this regularly - there may be some hints in my script (XCOPY maybe or other parameters)
This also includes mapping a drive and a log file - the former MAY be important the latter not.
// Map Q Drive - If Necessary!
SET ErrorMode=0;
QTest:
LOAD filename( ) as QExists
FROM Q:\NHSCS\DONOTDELETE.txt;
IF ScriptError=8 THEN
LET vExecString = 'CMD.exe /c NET USE Q: \\xx.xxx.xxx.xxx\c$ passwordforadministrator /USER:ADMINISTRATOR';
EXECUTE $(vExecString);
ENDIF
SET ErrorMode=1;
// Set CopyLog FileName
LET vLogFileName = DocumentName() & '_CopyLog.txt';
// Write time to Log File
LET vExecString = 'CMD.exe /c Date /t >> ' & '$(vLogFileName)';
EXECUTE $(vExecString);
LET vExecString = 'CMD.exe /c Time /t >> ' & '$(vLogFileName)';
EXECUTE $(vExecString);
// Copy file
LET vExecString = 'cmd.exe /c ECHO .. Copy File >> ' & '$(vLogFileName)';
EXECUTE $(vExecString);
LET vFileToCopy = 'CS_PA_External.qvw'; // Name of File with
LET vFromDir = 'D:\NHSCS\QVS_External\'; // Directory Path for Source
LET vToDir = 'Q:\NHSCS\LIVE\QVS_External\'; // Directory Path for Destination
LET vExecString = 'cmd.exe /c XCOPY $(vFromDir)$(vFileToCopy) $(vToDir) /Y/Z/F >> ' & '$(vLogFileName)';
EXECUTE $(vExecString);
Philip
GRRR
Im sorry. This was my fault. I had a problem in my script. The execute command works perfect.
Br
cristian
I have a sneaking suspicion that XCOPY is better then COPY for some reason but I cant remember why just at the moment. It may be faster? There is also some good reason for my extra / flags on the end but it is a while since I did it. Philip