File System - Synchronize folders
Declaration
<AMFILESYSTEM ACTIVITY="synchronize_folders" FOLDER1="text" FOLDER2="text" INCLUDE="text" EXCLUDE="text" SUBFOLDERS="YES/NO" INCLUDEREADONLY="YES/NO" />
Description
Synchronizes two folders either uni-directionally (one-way) or bi-directionally (both ways).
Practical usage
Ideally used to replicate folders between a machine and the local network or to backup one or more directories. If specifying a network location, folders should always be specified using UNC (Universal Naming Convention) paths instead of a mapped drive. For example: X:\pathname\ should be \\servername\pathname\. This is because mapped drives are available only when a user is logged on, therefore, tasks set to run in the background when the user is logged off will fail.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Folder 1 | Text | Yes | (Empty) | FOLDER1="c:\firstfoldername\" | The folder that should be synchronized. If synchronization method is set Unidirectional, then files from this folder that do not exist or are newer than their counterparts in Folder 2 will be transferred to the folder specified in the Folder 2 parameter. If synchronization method is set to Bidirectional, then files from folder 2 that are newer or do not exist will be transferred into this folder as well. |
Folder 2 | Text | Yes | (Empty) | FOLDER2="c:\otherfoldername\" | The destination folder and (optionally) file name that the files should be copied to. This can be a fully qualified path or a file name. Folders that do not exist will be automatically created at runtime. |
Synchronization | Text (options) | Yes | bidirectional | METHOD="uni" | The
method by which the files should be synchronized. The available
options are:
|
Advanced
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Include masks | Text | No | *.* | INCLUDE="*.txt" | The wildcard masks (such as * or ?) representing the files that should be synchronized. The default of *.* includes all files. |
Exclude masks | Text | No | (Empty) | EXCLUDE="*.doc" | The wildcard masks (such as * or ?) representing the files that should not be synchronized. If left blank no files are ignored. |
Include subfolders | Yes/No | No | No | SUBFOLDERS="YES" | Specifies whether subfolders and files inside them should be included in the synchronization. If selected, subfolders will be included in the synchronization. If disabled (default), subfolders will not be included. |
Include read only | Yes/No | No | No | INCLUDEREADONLY="YES" | Specifies whether files and folders marked as read-only are synchronized. If selected, read-only files and folders are overwritten by the proper source file before the read-only attribute is reset. This parameter is disabled by default. |
Example
- Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
- To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.
Description
Synchronize folder "C:\Dev" bi-directionally with "C:\Dev2". Process sub folders.
<AMFILESYSTEM ACTIVITY="synchronize_folders" FOLDER1="C:\Dev" FOLDER2="C:\Dev2" SUBFOLDERS="YES" INCLUDEREADONLY="YES" />