How To Optimize iFolder Synchronization with Advanced Filter Settings

How To Optimize iFolder Synchronization with Advanced Filter Settings

Scott Lv8

How To Optimize iFolder Synchronization with Advanced Filter Settings

Table of Contents

Disclaimer: This post includes affiliate links

If you click on a link and make a purchase, I may receive a commission at no extra cost to you.

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.

https://techidaily.com

Declaration

IFolderSyncFilters : IDispatch

Properties

Array 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.

https://techidaily.com

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()

Copy

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

  $advinst  = new-object -comObject "AdvancedInstaller"

$proj = $advinst.CreateProject($advinst.ProjectTypes.Architect)

https://techidaily.com

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”)

Copy
https://techidaily.com

See also

IAdvinstProject

IFolder

IPredefinedFolders

Did you find this page useful?

Please give it a rating:

Thanks!

Report a problem on this page

Information is incorrect or missing

Information is unclear or confusing

Something else

Can you tell us what’s wrong?

Send message

Also read:

  • Title: How To Optimize iFolder Synchronization with Advanced Filter Settings
  • Author: Scott
  • Created at : 2024-10-14 18:26:23
  • Updated at : 2024-10-16 17:38:19
  • Link: https://fox-ssl.techidaily.com/how-to-optimize-ifolder-synchronization-with-advanced-filter-settings/
  • License: This work is licensed under CC BY-NC-SA 4.0.