Coping files - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

yanivRa
Posts: 3
Joined: Thu Mar 30, 2006 12:45 pm

Coping files

Hi
Can i create an MSI that simply "looks" at a certain folder and copy all the existing files (the ones that exist) into a second folder

Thanks in advance
Yaniv
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

You can achieve this very easy with Advanced Installer. All you need is a vbs script custom actions. I'm assume that you want to run this VBS at the end of the installation (you can put this CA wherever you want). If so then here is what you must do:

1. Switch to "Custom Actions" page and create a "New Attached Custom Action" under the "InstallFinalize" standard action (if this standard action is not visible then make it visible by right clicking on "InstallExecuteSequance->Show Standard Action->Before Finalize->InstallFinalize").

2. At the "Source Path" browse for the VBS file. Edit "Function Name" with the function name in the VBS file in our case: "CopyDirectory". As an "Execution Condition" choose "Not installed". Leave all other options to their default values.

Here is the VBS script file:

Code: Select all

Function CopyDirectory
	SET fso = CreateObject("Scripting.FileSystemObject")
	fso.CopyFolder "sorcePath", "destPath", True
End Function
If you pass False to the 3rd argument for the CopyFolder function then this function doesn't copy files that already exist in the destination folder.

Regards,
Gigi
__________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com
dosas
Posts: 1
Joined: Fri Oct 13, 2006 2:06 pm

Hi,

I had a similar problem, but it came even an error.

I must copy the content of the folder \AppSub by the installation in the targetfolder and his subfolders. The folder \AppSub is beside the setup.exe.

What is the error in this script? :?:

Function CopyDirectory
SET fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFolder ".\AppSub", "ProgramFilesFolder\XYZ", True
End Function

Thomas
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

To access the value of a property in the VBS code you need to use this code:

Code: Select all

Session.Property("PropertyName")
So try with this script:

Code: Select all

Function CopyDirectory
SET fso = CreateObject("Scripting.FileSystemObject")
destination = Session.Property("ProgramFilesFolder")+"\XYZ"
fso.CopyFolder "..\AppSub", destination, True
End Function
Regards,
Gigi
________________
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”