Overview

Top  Previous  Next

Synchronization is feature provided in AnyClient that ensures that files in a local directory are the same as those in remote directory or vice versa.  Using synchronization you can quickly transfer only those files that have changed, saving both time and bandwidth utilization.

 

Enabling synchronization

 

To enable synchronization for a site, launch the Site Manager, select the desired site, and select the Sync tab.  Next, check the "Enable" option and enter the desired settings.

 

Figure 63

 

Figure63

 

Enable - If checked directory synchronization is enabled.

 

Local Directory - The local directory to synchronize from/to.

 

Remote Directory - The remote directory to synchronize from/to.

 

Sync Direction - The direction of synchronization.  "upload" indicates synchronization from Local Directory to Remote Directory, whereas "download" indicates synchronization from Remote Directory to Local Directory.

 

Sync Mode - The method used for determining whether a file should be synchronized.  Valid options are timestamp, filesize and checksum.  In order to use checksum option server must be FTP/S and support XCRC command.

 

Sync Recursively - If checked the directory and all sub-directories will be synced recursively.

 

Delete Orphaned Files - If checked files that exist on destination but do not exist in source will be automatically deleted.

 

Includes - Regular expression indicating what files to include during synchronization.

 

Excludes - Regular expression indicating what files to exclude during synchronization.

 

Performing synchronization

 

To perform synchronization, select the desired site from Site Manager and click the "Sync" button.  Files containing differences will be transferred from the source directory to target directory.

 

 

Figure 64

 

Figure64

 

Performing command line synchronization

 

To perform synchronization from the command line use the runsync command.  This command is especially useful if you wish to perform synchronization on a scheduled basis without requiring user interaction.  The runsync command requires at a minimum the -sitename parameter to specify what site to synchronize.  Available parameters are described below.

 

-sitename = the name of the site to be synced, case-sensitive

-sitexml = alternative site.xml file. the default is to look inside user's home dir for site.xml (optional)

-log = the path to a file where debug logs will be written. will replace file it it exists, be careful (optional)

-onsuccess = path to an executable that will be executed when sync succeeds (optional)

-onsuccessargs = arguments to onsuccess executable (optional)

-onfailure = path to an executable that will be executed when sync fails (optional)

-onfailureargs = arguments to onfailure executable (optional)

-v = be verbose

-h = display this help menu

 

Example

 

runsync -sitename "sftp-sync" -log "c:/path/to/file.log" -onsuccess "c:/path/to/success.bat" -v

 

The following event variables are also available after running a synchronization.

 

ANYCLIENT_SYNC_HOST

ANYCLIENT_SYNC_USER

ANYCLIENT_SYNC_PROTOCOL

ANYCLIENT_SYNC_PORT

ANYCLIENT_SYNC_LOCAL_DIR

ANYCLIENT_SYNC_REMOTE_DIR

ANYCLIENT_SYNC_DIRECTION

ANYCLIENT_SYNC_MODE

ANYCLIENT_SYNC_RECURSIVE

ANYCLIENT_SYNC_DELETE_ORPHANED

ANYCLIENT_SYNC_INCLUDES

ANYCLIENT_SYNC_INCLUDES

ANYCLIENT_SYNC_EXCLUDES

ANYCLIENT_SYNC_SYNCED_COUNT

ANYCLIENT_SYNC_ORPHANED_COUNT