Copy Folder Actions
In this section:
- About Copy Folder Actions
- Create a Copy Folder Action
- Synchronize Folder Behavior
- Mirror and Synchronize Folder Actions Configuration
About
Copy Folder Actions
There are three different actions which can be used to copy folders.
Copy
Copy the contents of a folder from the source to the target folder as defined in the Copy Existing Folder tab.
Only the contents of the folder are copied, the actual folder is not recreated at the destination location. For example, if the folder %USERPROFILE%\Documents\Information is specified as the source folder and %USERPROFILE%\Desktop is set as the target, the contents of the Information folder are copied directly to the desktop. In order to place them in a corresponding folder, manually amend the target field to:
%USERPROFILE%\Desktop\Information.
If a folder copy action contains files and all those files fail to match the conditions set in the action, the files are not copied but the folder is still created. Prior to Environment Manager 8.1 the target folder is not created if the files fail the conditions.
Mirror
The Mirror Copy Folder action creates an exact copy of a folder or folder structure and all the files contained within, at the target location specified in the Copy Folder dialog. Files which already exist in the target are overwritten from the source and any supplementary files in the target are deleted.
Synchronize
The Synchronize Copy Folder action combines the contents of two folders to produce a file and folder structure which is identical in both locations. If two files of the same name, type and location are encountered, the most recently modified is synchronized.
Use the Copy Folder dialog to specify the source and target folders to be synchronized when triggered.
It is expected that the Source folder is the permanent copy of the files. However, source folder contents may change from endpoint to endpoint. For the case where a local user has logged into a new endpoint, or the existing local profile is deleted, the folder %userprofile%\Documents is empty. If a synchronization action is implemented, it may delete the contents of the target folder. Please see the following Knowledge Base article for further information:
Copy Folder action deletes the contents of the Target if the Source is empty
Create a Copy Folder Action
- Select the Policy Configuration navigation button.
-
On the Actions ribbon, select File & Folder > Copy Folder.
The Copy Folder dialog displays showing the Copy Existing Folder tab.
When using Copy Folder actions, Read-only and Hidden attributes of folders and files are copied - if a file being copied is read-only in the source, it will be read-only when copied to the target. Advanced attributes for archiving, indexing, compressing and encrypting are not copied and revert to their default settings.
- Select the type of
copy you want to perform:
- Copy - Copy the contents of a folder from the source to the target folder as defined in the Copy Existing Folder tab. Only the contents of the folder are copied, the actual folder is not recreated at the destination location.
- Mirror - The Mirror Folder action creates an exact copy of a folder or folder structure and all the files contained within, at the target location specified in the Mirror Folder dialog. Files which already exist in the target are overwritten from the source and any supplementary files in the target are deleted.
- Sync -
The Synchronize Folder action combines the contents of two folders to
produce a file and folder structure which is identical in both locations.
If two files of the same name, type and location are encountered, the
most recently modified is synchronized.
Use the Synchronize Folder dialog to specify the source and target folders to be synchronized when triggered. Specifying the source and target folders is important for any local users who have accessed a new endpoint or if the existing local profile is deleted. Please see the Knowledge Base article: Copy Folder action deletes the contents of the Target if the Source is empty.
- From the Copy sub-folders
drop-down, select the required behavior:
- None - Only the top level folder and its contents are copied.
- All - All sub folders are copied.
- Specify the number of sub-folder levels - Sub-folders and their contents are copied to the level selected.
- Click Add.
- In the Source field, use the ellipsis (...) to navigate to the folder you want to copy.
- In the Target field, navigate to the folder to which the source folder will be copied when the action is triggered.
- Files which already exist in the target folder are copied if the same file in the source folder has changed. Environment Manager uses the file size and time stamp to determine whether a file has changed. Updated file attributes, such as Read-only, do not denote a changed file.
- Click the Options field and select as required. The available options are dependent on the type of Copy Folder action selected. See Copy Folder Options for details.
-
Repeat steps 3 to 7 to create further actions within the dialog.
Highlight an action and click Remove to delete an action from the dialog box. The action will not be created.
- Complete the
optional tabs as required.
See also Configuring Actions in the Action Management help.: -
Click OK.
Each action configured in the dialog is created in the selected node.
If a folder copy action contains files and all those files fail to match the conditions set in the action, the files are not copied but the folder is still created.
Copy Folder Options
Depending on the type of copy, a combination of the following options are available from the Options column for the action:
Option | Copy | Mirror | Sync |
---|---|---|---|
Continue on error - If selected and an error occurs during execution, the copy action continues. With this option checked and multiple files selected for copying, if one file fails to copy the action continues and the action is attempted for the remaining files. Failed copies are not retried. If the option is not checked, an error will be thrown and the action stops. The overall status of the action will still be a fail if this option is selected and an error occurs. |
|
|
|
Overwrite newer files - Use this option to determine the behavior when attempting to copy files which already exist in the Destination folder. If the option is selected and a newer version of a file exists in the Source folder, the version in the Destination folder is overwritten. If the option is not selected, the version of the file in the Destination folder is not overwritten. This does not cause the action to fail but to move on to the next file in the copy action. This option is selected by default. |
|
|
|
Fail if folder exists - Select to ignore the operation if a corresponding folder exists in the target. The action fails if the target folder already exists. |
|
|
|
Exclude junction points - Select whether to include or exclude folders and files identified as NTFS junction points or symbolic links in copy folder actions. For further information about junction points, see https://support.microsoft.com/en-us |
|
|
|
Copy file attributes - Includes the Read-only and Hidden attributes of the source folder in the copy - if a file being copied as part of a Copy Folder action is read-only in the source, it will be read-only when copied to the target. Advanced attributes for archiving, indexing, compressing and encrypting are not copied and revert to their default settings. |
|
|
|
Copy security attributes - Include the security permissions settings for each user and group that has been assigned access rights for the folder being copied. Note: The account executing the action must have the appropriate security permissions for this setting. |
|
|
|
Copy owner information
- Copy owner information from the source.
Note |
|
|
|
Include deleted files - When folders are synchronized, any files which have been removed from either the source or the target folder since the last sync, are removed from the corresponding location. This option is selected by default. |
|
|
|
For Copy Folder actions, exclusions and conditions can be applied using the standard action tabs.
Mirror and Synchronize Folder Actions Configuration
Parallel copy actions between the same folder should
be avoided.
When a node containing the above actions is run, unexpected behavior could occur as it is not clear whether folders A and B should be mirrored or synchronized first.
In such scenarios the actions should be configured sequentially to clearly define the action:
The folders have been synchronized prior to the mirror.
Parallel copy actions between unrelated folders function as normal.
Synchronize Folder Behavior
The sections below explain Synchronize Folder behavior in various circumstances.
Delete Behavior
Following synchronization, the source and target folders contain the same files. If a file is deleted from one of the locations, it will be copied back when the folders are next synchronized - files are always synchronized, never deleted.
Action | Source | Target |
---|---|---|
Create file in Source folder | File A | |
Synchronize Source and Target | File A | File A |
Delete file from Target folder | File A | |
Synchronize Target and Source | File A | File A |
However, if you select the Include deleted files option, when synchronized, the deletion of File A from the target folder would be reflected in the source:
Action | Source | Target |
---|---|---|
Create file in Source folder | File A | |
Synchronize Source and Target | File A | File A |
Delete file from Target folder | File A | |
Synchronize Target and Source |
Rename Behavior
Following a folder synchronize, if a file is renamed in either the source or target folder, when the folders are next synchronized, the original file and the renamed file will be present in both locations.
Action | Source | Target |
---|---|---|
Create file in Source folder | File A | |
Synchronize Source and Target | File A | File A |
Rename file in Target Folder | File A | File B |
Synchronize Target and Source | File A File B | File A File B |
As with deletes, the results are different if you select the Include deleted files option. When synchronized, a file renamed in either the source or target folder, will be renamed in the opposite location. In the example below, in the target location, File A is renamed to the File B. When the locations are synchronized, the file is renamed in the source.
Action | Source | Target |
---|---|---|
Create file in Source folder | File A | |
Synchronize Source and Target | File A | File A |
Rename file in Target Folder | File A | File B |
Synchronize Target and Source | File B | File B |