Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
dmohanty
Partner - Specialist
Partner - Specialist

EXECUTE command to move files listed in an XLSX or TXT ?

Hi All,

I am in process of Moving and Coping some QVWs/QVDs from one Destination to other using an EXECUTE command in a QVW.

EXECUTE cmd.exe /C MOVE "SOURCE"  "DESTINATION"

EXECUTE cmd.exe /C COPY "SOURCE"  "DESTINATION".


Requirement -


Want to write the name of QVDs/QVWs in a single XLSX or TXT file, so that EXECUTE can read the file and MOVE and COPY all the entries in them. This would avoid writing the EXECUTE command multiple times for multiple files.


Any suggestions?


Regards!

1 Solution

Accepted Solutions
pradosh_thakur
Master II
Master II

Hi

so you want to do


EXECUTE cmd.exe /C COPY "SOURCE"  "DESTINATION"

EXECUTE cmd.exe /C COPY "SOURCE1"  "DESTINATION1"

to

EXECUTE cmd.exe /C  xCOPY /Y /I  "SOURCE"  "DESTINATION" &&  "SOURCE1"  "DESTINATION1"


1:

store all the source and destination in table and use EXECUTE cmd.exe /C COPY "SOURCE"  "DESTINATION" inside a for loop

2:

store source and destination in a file and concatenate them in such a way that they form the part in bold and use a variable instead

EXECUTE cmd.exe /C  xCOPY /Y /I  "SOURCE"  "DESTINATION" &&  "SOURCE1"  "DESTINATION1"


regards

Pradosh


Learning never stops.

View solution in original post

5 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

You could do the looping over set of filenames in a file in a WIndows batch file. Look here for an example:

scripting language - Copy a list (txt) of files - Stack Overflow

or here

https://www.google.com/search?source=hp&ei=jKd6W9SdN8HTkwX5lLPYCw&q=windows+command+line+moving+a+li...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi jontydkpi

This is cool. Thanks for this.

I was thinking to that in EXECUTE so that I can Automate the Reload of the the QVW in QMC.

Anyways, if we are doing that in a BATCH file, need to automate that may be by Windows Task Scheduler or Powershell.

jonathandienst
Partner - Champion III
Partner - Champion III

I was thinking you would use EXECUTE to call the batch file from within the script...

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
pradosh_thakur
Master II
Master II

Hi

so you want to do


EXECUTE cmd.exe /C COPY "SOURCE"  "DESTINATION"

EXECUTE cmd.exe /C COPY "SOURCE1"  "DESTINATION1"

to

EXECUTE cmd.exe /C  xCOPY /Y /I  "SOURCE"  "DESTINATION" &&  "SOURCE1"  "DESTINATION1"


1:

store all the source and destination in table and use EXECUTE cmd.exe /C COPY "SOURCE"  "DESTINATION" inside a for loop

2:

store source and destination in a file and concatenate them in such a way that they form the part in bold and use a variable instead

EXECUTE cmd.exe /C  xCOPY /Y /I  "SOURCE"  "DESTINATION" &&  "SOURCE1"  "DESTINATION1"


regards

Pradosh


Learning never stops.
dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi pradosh_thakur

Thanks.

Your XCOPY Command and the Concatenation trick helped a lot. This is helping me achieving the results as well.

Also, I had already used the Storing in a Table technique as below -

QVW:
LOAD
QVW
FROM
Path\Deployment.xlsx
(
ooxml, embedded labels, table is QVWs);


FOR Each vQVW in FieldValueList('QVW')
EXECUTE cmd.exe /C COPY   "SOURCE" "DESTINATION";
NEXT vQVW

DROP TABLE QVW;