1. Copy file(s) from the server's work space and put them in the agent's workspace.

Note the > operator tells us we're sending files from the server to the agent.

Rule Example Type 1 - Operators (Server to Agent)
[1.1] Test\** >   Output
[1.2] Test\** ->  OutputFlattened
[1.3] Test\** >>  OutputEmptied
[1.4] Test\** ->> OutputEmptiedFlattened

Each rule will find all files in the Test directory in the server's workspace and copy them to the agent's workspace directory.

[1.1] - Puts files and directories in \Output. Preserves the directory structure.

[1.2] - Traverse the entire directory structure of Test and put all files matched into the \OutputFlattened directory on the agent. Also so known as flattening the files.

[1.3] - Before copying the files and preserving their path, make sure \OutputEmpied is actually empty.

[1.4] - Before copying the files and flattening them, make sure \OutputEmpiedFlattened is actually empty.

 

2. Copy file(s) from the agent's work space and put them in the server's workspace.

Note the < operator tells us we're sending files from the agent to the server .

Rule Example Type 2 - Operators (Agent to Server)
[2.1] Test < Output\**
[2.2] TestFlattened\ <- Output\**
[2.3] TestEmptied\ << Output\**
[2.4] TestEmptiedFlattened\ <<- Output\**

Each rule will find all files in the Output directory in the agent's workspace and copy them to the server's workspace directory.

[2.1] - Puts files and directories in \Test. Preserves the directory structure.

[2.2] - Traverse the entire directory structure of Output and put all files matched into the \TestFlattened directory on the server. Also so known as flattening the files.

[2.3] - Before copying the files and preserving their path, make sure \TestEmpied is actually empty.

[2.4] - Before copying the files and flattening them, make sure \TestEmpiedFlattened is actually empty.

 

3. Copy files using different wildcards

The example rules below all use the preserve operator > or <, for these examples it's not the operator that's important so we've just used any.

Rule Example Type 3 - Wildcards
[3.1] Test\* > Output
[3.2] Test\image_?.png > Output
[3.3] Test\*.??? > Output
[3.4] Test\*\**.dll > Output
[3.5] Test\**.xml > Output

[3.1] - Matches any files (not directories) in the server's \Test directory and puts them in the agent's \Output directory.

[3.2] - Matches any files with the name "image_" followed by a single character, followed by ".png" and puts them in the agent's \Output directory.

[3.3] - Matches any files (not directories) in the server's \Test directory which end with a period "." followed by 3 characters. It basically matches any files that have a 3 character long file extension.

[3.4] - Matches any files ending with  ".dll" and are two directories down from the server workspace's \Test directory. The first wild card matches a single level of directories.

[3.5] - Matches any files ending with ".xml" anywhere underneath the server workspace's \Test directory.

 

4. Copy files and maintaining directory structure

Using the preserve paths operator won't preserve the entire path of the file that's matched. It will only preserve paths matched by the directories the wild card matches. If you specify a directory name with no wildcards in your pattern and that directory comes before any wildcards, then to keep that exact structure you must put those directories in the destination path.

Rule Example Type 4 - Entire path preserving
[4.1] Test\**.xml > Output
[4.2] Test\Stuff\**.xml > Output
 
# Notice how the destination pattern directories mimic the non-wildcard directories in the source pattern.
[4.3] Test\**.xml > Output\Test
[4.4] Test\Stuff\**.xml > Output\Test\Stuff

[4.1] and [4.2] - Any files matched are put in the \Output directory and the directory they were found in will be created in \Output.

[4.3] - Any files matched are put in the \Output\Test directory and the directory they were found in will be created in \Output\Test.

[4.4] - Any files matched are put in the \Output\Test\Stuff directory and the directory they were found in will be created in \Output\Test\Stuff.

 

5. Copy files to the workpace's root directory

The root of the workspace can be specified by either a forward slash "/" or a backslash "\".

Rule Example Type 5 - Workspace root
[5.1] AppInstallers*.exe > /
[5.2] / < AppInstallers*.exe

[5.1] - Matches any files in the root of the server's workspace that start with "AppInstallers" and ends with ".exe" and puts them in the agent's workspace root.

[5.2] - Matches any files in the root of the agent's workspace that start with "AppInstallers" and ends with ".exe" and puts them in the server's workspace root.

 

6. Excluding files from being copied

Exclude rules are grouped by direction (Server to Agent/Agent to Server) and applied to all include patterns that match the direction.

Rule Example Type 6 - Exclude patterns
[6.1a] Output\** > LotsOfStuff
[6.1b] -Output\**.xml > 
 
[6.2a] Installers < Output\**
[6.2b] - < Output\**.xml
[6.2c] - < Output\**.dll

[6.1a] and [6.1b] execute together. The server pattern Output\** starts generating a list of files it matches, as a match is found it's checked against every exclude pattern, in this example there is only one Output\**.xml. The result of combining these two rules is every file in the server's \Output directory is copied to the agent's \LotsOfStuff directory except for files that end with ".xml".

[6.2a], [6.2b] and [6.2c] also executed together. The agent pattern Output\** starts generating a list of files it matches, as a match is found it's checked against the two exclude patterns [6.2b] and [6.2c]. This example will copy all files in Output\ except for those that end with ".xml" or ".dll" and puts them in the \Installers directory on the server-side workspace.