creativeinflux
Posts: 3
Joined: Wed Jan 09, 2008 3:57 am

Copying folders

Hi,

I am new to software dev and installers. I have an application that has a .exe and a folder called "xml". The xml folder contains the data for the .exe that i will add new xml files to in the future. What I need to do is create a generic installer that will install the .exe and copy the xml folder. For example, currently I am able to create a installer that will install the .exe and xml folder, but when I add a new xml file to the xml folder, I need for the installer to install or copy the new xml data.

Any help would be much appreciated.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

If you need to install an EXE file and a folder (empty or not), you can add them in "Application Folder" in the "Files and Folders" page, build the project and install it.

When you add new xml files in the "xml" folder (in your Advanced Installer project) and you want to update the original installation (add the new xml files to the installed application) you have two options:
1) you use a patch
2) you use the automated upgrade feature

1) A patch project is basically the difference between two MSI packages (which makes it very small) and you can use it to update an installation. You can read more about patches here:
http://www.advancedinstaller.com/user-g ... oject.html
http://www.advancedinstaller.com/user-g ... tches.html
http://www.advancedinstaller.com/user-g ... patch.html

2) The automated upgrade feature works like this:
- you install a MSI on the target machine,
- you increase it's version and update some of it's files
- you answer "Yes" when changing the Product Code
- when running the updated MSI on the target machine the old installation will be removed and the updated package will be installed

Note that in order to use this feature you need to have the "Automatically upgrade older product versions" option set in the "Upgrades" page.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
creativeinflux
Posts: 3
Joined: Wed Jan 09, 2008 3:57 am

Hi Cosmin,

Thank you for taking a look at my post. I took a look at your suggestion and it appears that for what I am trying to do it may not work. Let me explain...

Step 1
We currently have a file structure as such:
setup.msi
game.exe
xml folder with 2 xml files

Step2
We are going to send this out on a cd to a client.

Step3
Later we add a xml file to the xml folder and resend the same files with the addition.
setup.msi
game.exe
xml folder with 3 xml files (new xml file added)

Are we able to create an installer that will just copy whatever is in the xml directory with having to create a new setup.msi or patch installer? This way if the client addes a new xml file to the cd, they don't have to contact us to create a new installer or patch because the setup.msi will copy what is in the xml file regardless of additions.

Best
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

If you don't want to upgrade the installation, what you need can be done with "File Copy/Move" file operations:
- you create your MSI package without the xml files
- in the Advanced Installer project, in the "Install Parameters" page, you create the SOURCEDIR property (the value doesn't matter because it will be set at runtime)
- in the "Files and Folders" page you create a property-based folder using SOURCEDIR
- in the APPDIR folder you create a "File Copy/Move" operation (you can use the "New File Operation" button on the toolbar) that looks like this:

Source File
Name: *.xml
Folder: SOURCEDIR\xml
Destination File
Name: (empty)
Folder: APPDIR
Properties
Component: application.exe (you will choose from the combo box a component that is always installed)
Operation: Copy

- this file operation will copy all the XML files in the SourceDir\xml folder (SourceDir is the folder from which the MSI is launched) to the installation folder
- in the "Custom Actions" page you create an "Attached Custom Action" like explained in this thread:
http://www.advancedinstaller.com/forums ... ove+folder
- this custom action is used to remove the files and the installation folder after the uninstall process

Note that if your installation uses a boostrapper (I'm not sure if "game.exe" is the boostrapper of your installation package), then you will use SETUPEXEDIR instead of SOURCEDIR.

Let me know if you encounter any problems or if you need a sample project.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
creativeinflux
Posts: 3
Joined: Wed Jan 09, 2008 3:57 am

Hi Cosmin,

I tried the steps you showed but was unable to get it to work.

Here's what I did:

1. Started a new project and went to the Install Parameters and added a property:
Name: SOURCEDIR
Value: Your Value

Build: DefaultBuild
Selected: Use default value

2. Selected Files and Folders and added the game.exe to the Application Folder

3. In the "Files and Folders" page I created a property-based folder using SOURCEDIR.

4. In the APPDIR folder (I think is the Application Folder) I went to create a "File Copy/Move" that looks like this:

Source File
Name: *.xml
Folder: SOURCEDIR\xml <---- I am not able to add this, only the SOURCEDIR
Destination File
Name: (empty)
Folder: APPDIR
Properties
Component: <----- not sure what to put here. do i select the game.exe file?
Operation: Copy

If you have an example project, that would be great.

Best,
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
1. Started a new project and went to the Install Parameters and added a property:
Name: SOURCEDIR
Value: Your Value
Please use a valid path for the value of SOURCEDIR (for example "C:\").
Folder: SOURCEDIR\xml <---- I am not able to add this, only the SOURCEDIR
This is because SOURCEDIR doesn't contain a folder named "xml". Please create the "xml" folder under SOURCEDIR (in the "Files and Folders" page).
Component: <----- not sure what to put here. do i select the game.exe file?
In the "Component" combo you should select a component which is always installed (for example the component of the main EXE of your application).

If you need a sample project please contact me at support at advancedinstaller dot com and I will send it to you.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ms_bhandari
Posts: 11
Joined: Mon Feb 25, 2008 8:31 pm
Location: VA

Re: Copying folders

Hello,

Is it possible to copy the sub folders and contents of sub folder too?

Thanks.

Madhu
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Copying folders

Hi,

I'm not sure why you need this. Can you please give me more details about what you need to do?
Please note that this is not supported by Windows Installer. However, you can use a custom action which copies the files and folders.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ms_bhandari
Posts: 11
Joined: Mon Feb 25, 2008 8:31 pm
Location: VA

Re: Copying folders

Hello Cosmin,

I am planning to copy all the files from folder 'Data' and it's sub folders. Some of the sub folders content other sub folders too.

Also how can I remove these copied files during uninstall.

Thanks.

Madhu
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Copying folders

Hi Madhu,
I am planning to copy all the files from folder 'Data' and it's sub folders. Some of the sub folders content other sub folders too.
Can you please give me more details about why you don't include this folder in the installation package? Why do you need it outside the MSI?
Also how can I remove these copied files during uninstall.
Since the files and folders are created by a custom action, the package can remove them only through another custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ms_bhandari
Posts: 11
Joined: Mon Feb 25, 2008 8:31 pm
Location: VA

Re: Copying folders

Cosmin,
Can you please give me more details about why you don't include this folder in the installation package? Why do you need it outside the MSI?
I am looking for not to update the msi file when new database file will be added or removed existing one.

Thanks.

Madhu
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Copying folders

Hi,

This is not supported by Windows Installer, therefore it can be done only through a custom action.
For example, you can run xcopy.exe from the "System32" folder with the appropriate parameters in order to copy the folder. Also, you can remove it by launching "cmd.exe" with the Rmdir command.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
how_fun
Posts: 5
Joined: Tue Jun 03, 2008 8:53 pm

Re: Copying folders

cosmin wrote:Hi,

I'm not sure why you need this. Can you please give me more details about what you need to do?
Please note that this is not supported by Windows Installer. However, you can use a custom action which copies the files and folders.

Regards,
Cosmin
Can you explain in detail how to get to there?
thanks,

Hong
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Copying folders

Hi Hong,

I'm not sure I understand what you mean. Can you please give me more details about this?

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
how_fun
Posts: 5
Joined: Tue Jun 03, 2008 8:53 pm

Re: Copying folders

cosmin wrote:Hi Hong,

I'm not sure I understand what you mean. Can you please give me more details about this?

Regards,
Cosmin

Thanks for such a quick response. I try to add a customer action to xcopy a folder to the install forder. I failed. here is the command I type in the Command Line:

xcopy ".\Sample Templates" "[APPDIR]\\Sample Templates" /s /e /y /q /I


thanks,


Hong

Return to “Common Problems”