cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
_shielder_
Level 6

Copy Files

My install consists of my application files plus 2 extra files.
I need to move or copy these 2 extra files into an existing directory on the destination machine. They need to be in place before I execute some SQL Scripts. Then I want to delete the same 2 files at the end of the install.

I'm new to InstallShield so this is probably very simple.

Thanks for the help!
Labels (1)
0 Kudos
(5) Replies
SMadden
Level 6

I depends on the project type you have, is it InstallScript, Basic MSI or InstallScript MSI?

Sandra
0 Kudos
_shielder_
Level 6

InstallScript MSI
0 Kudos
SMadden
Level 6

To do it with script, you could add them to the Support Files View, disable logging to make the next operations not show up in the uninstall log, copy the files over to the new location, call the SQL scripts and then cleanup what was done before.

The code would look something like this

Disable(LOGGING);
XCopyFile(SUPPORTDIR ^ "File1", szTargetDir, COMP_NORMAL);
XCopyFile(SUPPORTDIR ^ "File2", szTargetDir, COMP_NORMAL);

//call SQL scripts

DeleteFile(szTargetDir ^ "File1");
DeleteFile(szTargetDir ^ "File2");
Enable(LOGGING);


It would also be a good idea to add some code to check if either of the files already exists in the target location and then skip deleting them.

Sandra
0 Kudos
TheTraveler
Level 8

Instead of using XCopyFile, you could use CopyFile function.
0 Kudos
_shielder_
Level 6

Thanks I'll try that.
0 Kudos