<< back to sysax.com Product page

Chapter 8. Synchronizing Files and Folders

Files can be synchronized between source and destination folders. Synchronization can be performed between local and remote computers or between two drives or folders on a local computer.

The setsource command is used to specify the source folder that needs to be synchronized and the rules for including or excluding files and folders contained in the source. The local or remote keywords indicate if the source is located on a local or remote computer. The include or exclude keyword is followed by a list of files or folders to be excluded or included in the source folder. Each of the file or folder pattern is prefixed by a "file=" or "folder=" string to indicate if the pattern should match a file or folder.

Exhibit 8.1. Syntax of command to set source path for synchronization

setsource <keywords: local, remote>, <path of source folder>, [<keywords: include, exclude>, "<file, folder>=<pattern>" ...];

Exhibit 8.2. Example of command to set source path for synchronization

setsource local, "c:\\ftpfolder", include, "file=*.txt", "file=*.doc", "folder=*data*", "folder=*info*";

The setdestination command is used to specify the destination folder that needs to be synchronized and the rules for preserving or removing extra files and folders contained in the destination (that are not present in the source). The local or remote keyword indicates if the destination is located on a local or remote computer. The preserve or remove keyword is followed by a list of files or folders that are present only in the destination and need to be preserved or removed. Each of the file or folder pattern is prefixed by a "file=" or "folder=" string to indicate if the pattern should match a file or folder.

Exhibit 8.3. Syntax of command to set destination path for synchronization

setdestination <keywords: local, remote>, <path of destination folder>, [<keywords: preserve, remove>, "<file, folder>=<pattern>" ...];

Exhibit 8.4. Example of command to set destination path for synchronization

setdestination remote, "/ftpdata", remove, "file=*.obj", "file=*.bin", "folder=*temp*", "folder=*tmp*";

The syncrun command is used to start the synchronization operation. The bysize, bydate, bylargersize, bynewerdate, bycrc, bymd5, and bysha1 keywords are used to indicate the type of comparison to be performed between the source and destination. The main difference between synchronization and backup is that during synchronization, files and folders that exist only in the destination, that are selected to be preserved, are copied to the source folder. Also, if the bylargersize, and bynewerdate comparison types are selected, the source files will be replaced by the destination files if they are found to be newer or larger than corresponding files in the source folder.

Exhibit 8.5. Syntax of syncrun command

syncrun <keywords: bysize, bydate, bylargersize, bynewerdate, bycrc, bymd5, bysha1>;

Exhibit 8.6. Example of syncrun command

syncrun bysize; #synchronize using size based comparison