IFolderSyncFilters

This interface is meant to specify the filters that allow you to select which files will be added from the synchronized folder to the package.

Declaration

IFolderSyncFilters : IDispatch

Properties

Array<String> NamePatterns - Gets the collection of the patterns that will be used to filter files.

Bool ReadOnlyFiles - Gets or sets the option that will specify if the “ReadOnly” attribute of the files that will be added to the package.

Bool HiddenFiles - Gets or sets the option that will specify if the “Hidden” attribute of the files that will be added to the package.

Bool SystemFiles - Gets or sets the option that will specify if the “System” attribute of the files that will be added to the package.

Bool ArchiveFiles - Gets or sets the option that will specify if the “Archive” attribute of the files that will be added to the package.

Bool SparseFiles - Gets or sets the option that will specify if the “Sparse” attribute of the files that will be added to the package.

Bool ReparsePointFiles - Gets or sets the option that will specify if the “ReparsePoint” attribute of the files that will be added to the package.

Bool CompressedFiles - Gets or sets the option that will specify if the “Compressed” attribute of the files that will be added to the package.

Bool OfflineFiles - Gets or sets the option that will specify if the “Offline” attribute of the files that will be added to the package.

Bool EncriptedFiles - Gets or sets the option that will specify if the “Encripted” attribute of the files that will be added to the package.

String ExcludeSubfolders - Gets or sets the excluded sub-folders. This is available only on exclude filters.

Methods

NewNamePattern(String aNamePattern) - Adds a new name pattern to the collection that will be used to filter files.

RemoveNamePattern(String aNamePattern) - Removes a name pattern from the collection that will be used to filter files.

Examples

Method 1: use Advanced Installer support for folder synchronization

       $advinst  = new-object -comObject "AdvancedInstaller"
 $proj     = $advinst.CreateProjectS("architect")
 $new_folder = $proj.PredefinedFolders.ApplicationFolder.CreateFolder("MyApplication")
 $new_folder.Synchronization.SourceFolder = "D:\MyApplication\MyApplication\bin\Release"
 $new_folder.Synchronization.ExcludeFilters.NewNamePattern("*.pdb")
 $new_folder.Synchronization.ExcludeFilters.NewNamePattern("*.aip")
 $proj.SaveAs("D:\MyApplication\MyApplication\Setup\Setup.aip")
 $proj.Build()

    

Method 2: use PowerShell for scanning folder contents + Advanced Installer

      $advinst  = new-object -comObject "AdvancedInstaller"
$proj     = $advinst.CreateProject($advinst.ProjectTypes.Architect)
# add new folder
$new_folder = $proj.PredefinedFolders.ApplicationFolder.CreateFolder("MyApplication")
$folder_to_sync = "D:\MyApplication\MyApplication\bin\Release"
# get all resources from folder
$resources = Get-ChildItem $folder_to_sync -Exclude ("*.pdb", "*.aip") -Recurse
foreach ($res in $resources) 
{
    # check if is directory
    if($res.Mode -eq "d-----")
    {
        # create path to folder in aip
        $path_to_aip = $res.FullName.Replace($folder_to_sync, $new_folder.FullPath)
        # create folder if it does not exist in aip
        if (!$proj.FoldersComponent.FindFolderByPath($path_to_aip))
        {
            # create path relative to $new_folder
            $folder_path_relative = $path_to_aip.Replace("$($new_folder.FullPath)\", "")
            $new_folder.CreateFolder($folder_path_relative)
        }
    }
    # item is a file and should be added to project
    else
    {
           # create path to file relative to $new_folder
           $file_path_relative = $res.Directory.FullName.Replace("$($folder_to_sync)\", "")
           if ($res.Directory.FullName -eq $folder_to_sync)
           {
                $proj.FilesComponent.AddFileS($new_folder.FullPath, $res.FullName)
           }
           else
           {
                $proj.FilesComponent.AddFileS("$($new_folder.FullPath)\$file_path_relative", $res.FullName)
           }
    }
}
$proj.SaveAs("D:\MyApplication\Setup\Setup.aip")

    

See also

IAdvinstProject

IFolder

IPredefinedFolders