Posts: 6739
Joined: Wed Jun 13, 2018 7:49 am

Synchronization - exclude all files of a specific type but few

Hello guys,

This how-to will be short and sweet. :)

The scenario we have on our hands today is the following: on of our customers wanted to synchronize one folder from the project with one folder on the disk, but in the process he wanted to exclude all the XML files but few from a subfolder.

Unfortunately, this would require some regex which we unfortunately do not have support for for the "Include" and "Exclude" filters.

To better understand this, I say we work on an example. Consider we have the following folder structure on disk:
Screenshot_15.png (11.56 KiB) Viewed 305122 times
Screenshot_16.png (9.23 KiB) Viewed 305122 times

If we open our project, enable synchronization of "Application Folder" with our folder from the disk and while doing so, we also exclude all the XML files, we can notice that "three.xml" and "four.xml" are not included, although we want them to be.
Screenshot_17.png (48.96 KiB) Viewed 305122 times

In order to have them included, we can use the following workaround:
  • go to "Properties" page and create a new empty property
Screenshot_18.png (6.13 KiB) Viewed 305122 times
  • in the "Files and Folders" page --> right click on "Application Folder" --> "New folder" --> "Property based" --> select the property we previously created
  • we can then synchronize this folder with the "subfolder" from the disk (where the XML files we want included are)
Screenshot_19.png (11.09 KiB) Viewed 305122 times
  • after that, we can use the "SetDirectoryPath" custom action to set the property-based folder to the value of our subfolder
Screenshot_20.png (42.8 KiB) Viewed 305122 times

In my screenshot, you will see that the custom action is duplicated. Basically what I have done there is to share it between the two stages (using shift + drag and drop)

After doing so, select the one under "Install Execution Stage" --> under "Execution Stage Condition" --> click "Advanced execution scenarios..." hyperlink and select "Skip action in Install Execution Stage if executed in Dialogs Stage".

This will make the custom action to not be executed twice if the setup is launched with full UI.

This way, after the installation, you should have the two XML files in the subfolder of the installation directory.

Hope this helps! :)

Best regards,
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Sample Projects”