GlenT
Posts: 118
Joined: Mon Jul 16, 2012 8:44 pm

How to easily duplicate a folder structure

We have a set of folders containing sample files and parts that are installed in the current user's My Documents folder. Most of the folders that make up this set use synchronization with folders on the production machine so that they get updated automatically when new content is added to distribution (about a thousand files). This works fine.

I wanted to duplicate this folder struction in the Program Files\Common Files folders (we have a runtime mechanism for allowing users in other profiles on the target workstation to copy the same sample files to their own profile on demand). However, when I copied the top level folder (and all sub-folders) from My Documents in AI to the Common Files folder in the AI project, all my synchronized folders were turned into normal folders, which I don't want because then I have to maintain this second set of folders individually. And I really don't want to have to recreate the entire folder structure again from scratch.

What I really need is an easy way to alias or duplicate the folder set in My Documents to the Common Files folder.

P.S. A second question as an after-thought: how do I sort the entries in the Application Shortcut Folder. It is defaulting to alpha order, but I want the main app. to be the first in the list.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to easily duplicate a folder structure

Hello and welcome to Advanced Installer forums,

In order to achieve what you want, after you copy the related folders structure from "My Documents" folder to "Common Files" folder, you can mark the root folder of the copied folders structure as "synchronized".
P.S. A second question as an after-thought: how do I sort the entries in the Application Shortcut Folder. It is defaulting to alpha order, but I want the main app. to be the first in the list.
Please keep in mind that shortcuts in the start menu are ordered alphabetically. This is handled automatically by Windows Installer. Therefore, the shortcuts cannot be displayed in a custom order.

Let us know if this helps, otherwise please give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
GlenT
Posts: 118
Joined: Mon Jul 16, 2012 8:44 pm

Re: How to easily duplicate a folder structure

Correct me if I am wrong, but marking the root folder of the copied folder structure as synchronized, will only synchronize it to the source folder structure, not to the other installed folder structure, correct? I would want to synchronize it to the installed folder structure.

I should clarify that I set synchronize on a per-folder basis, not the entire folder structure. Some folders are not sync'd. Some files are put into more than one folder, etc. sync'ing the top level folder won't work. Folders are selectively pulled from the source folder structure based on a number of different products which have their own installers.

I should also mention that with ISX, when a folder set is copied and pasted, the sync info on a per-folder basis goes with it.

If other methods are not available, would it be possible to do this in the XML project file without royally screwing everything up?
Last edited by GlenT on Wed Jul 18, 2012 6:13 pm, edited 1 time in total.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to easily duplicate a folder structure

Hello,
Correct me if I am wrong, but marking the root folder of the copied folder structure as synchronized, will only synchronize it to the source folder structure, not to the other installed folder structure, correct? I would want to synchronize it to the installed folder structure.
Yes, when you mark a folder as synchronized the content of the related folder will be synchronized to the content of the source folder on disk. You can take a look on our "Synchronized Folders" article.

Also, can you please send us the .AIP (project file) and more details about your folders structure (maybe exemplify) to support at advancedinstaller dot com so we can investigate your scenario?
I should also mention that with ISX, when a folder set is copied and pasted, the sync info on a per-folder basis goes with it.
If other methods are not available, would it be possible to do this in the XML project file without royally screwing everything up?
This seems to be an Advanced Installer issue. A fix will be available in a future version of Advanced Installer, thank you for bringing it to our attention. Until then, I'm afraid you should manually re-mark as synchronized the related folders.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
GlenT
Posts: 118
Joined: Mon Jul 16, 2012 8:44 pm

Re: How to easily duplicate a folder structure

Thanks Daniel. I've sent the "All Inclusive" version of our project. The part that we want to copy or mirror to two locations on the target computer includes 78 synchronized folders and approximately 1400 sample files that end users can edit and adapt for their own use. You can see that this will be a lot of work, especially considering that we have 7 different products with their own unique installers.

The purpose of this is to provide a mechanism for multiple authenticated users on a workstation to have their own copies of these files in their own Documents folder.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to easily duplicate a folder structure

Hello Glen,

Please keep in mind that if you copy your folders structure from "My Documents" to "Common Files" folder in "Files and Folder" view, then the related folders structure will be added twice in your installation package when having "Place files unpacked next to the MSI database" option enabled from "Media" -> "Configuration" tab.

So, if you want to have a smaller installation package size you can create a custom action which will copy the related folders structure, after installation, from "My Documents" to "Common Files" folder. The custom action should be scheduled after "Install Execution Stage" -> "Add Resources" standard action on "Custom Action" page and should run as "Deferred with no impersonation".

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
GlenT
Posts: 118
Joined: Mon Jul 16, 2012 8:44 pm

Re: How to easily duplicate a folder structure

This is the good idea. I will experiement with this. Thanks Daniel.

But do I then have to create a corresponding custom action to delete the copied files at uninstall time?

OK, I'm a little confused about how I do the Copy. Do I have to create a batch file or a script to do this and then add it to the project and call it with a custom action? I was kind-of expecting to find a built in copy action of some kind.
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: How to easily duplicate a folder structure

Hello Glen,
But do I then have to create a corresponding custom action to delete the copied files at uninstall time?
Yes, it is recommended to use a corresponding custom action, scheduled on uninstall, which will delete the related files and folders.
Do I have to create a batch file or a script to do this and then add it to the project and call it with a custom action? I was kind-of expecting to find a built in copy action of some kind.
Yes, you can have a bat or a script file which can be launched through a "Launch file or open URL" custom action. Also, if you want to use a script file you can launch it through a "Launch attached file" custom action.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”