How to copy/move many files at once in Visual Installer’s script language

There is a built-in script language available in Visual Installer. The script language is very versatile and with the script commands you can do different kind of file operations and other types of operations during an installation.

File copy operationOne common operation is to copy or move files during an installation. There are commands available in Visual Installer’s script language that can do this. If you need to copy or move many files at once, you can use the MCOPY and MMOVE commands for this purpose. Below is the syntax of these two commands described:

MCOPY %Source, %DestinationDir
Copies many files at once. %Source specifies the source file path and %DestinationDir specifies the destination folder for the files.

MMOVE %Source, %DestinationDir
Moves many files at once. %Source specifies the source file path and %DestinationDir specifies the destination folder for the files.

   
You can use wildcards with the %Source parameter. Example: “%DESTDIR\Data\*.txt”. The code examples below show how to use these two commands with wildcards etc.:

Example 1 – Copy many files at once
Copies all files in the %DESTDIR\Data folder to the %DESTDIR\NewPlace folder:

MCOPY %DESTDIR\Data\*.*, %DESTDIR\NewPlace

Example 2 – Move many files at once
Moves all text files in the %DESTDIR\Data folder to the %DESTDIR\NewPlace folder:

MMOVE %DESTDIR\Data\*.txt, %DESTDIR\NewPlace

To add script commands to an installation, you need to open the Special – Execute script commands menu item in Visual Installer’s editor. More information is available in this tip.

   
More information
For more information about Visual Installer’s script language, see this web page:

> Advanced Tips & Tricks for SamLogic Visual Installer