VanDyke Software



True Mirroring With SecureFX® 6.0

Many file transfer tasks involve keeping two sets of files synchronized, which is a tedious job to do manually when there are dozens or hundreds of files. That's where SecureFX's Quick Synchronize comes in, to help you rapidly configure the transfer, view files before committing, and confirm the results. While a version of mirroring in Quick Synchronize has been offered since SecureFX 1.6, "true" mirroring is available beginning with version 6.0. Now synchronized files can be deleted as well as created and updated. This tip walks you through the complete process of mirroring files, with website maintenance as its example.

Mirroring is the ability to exactly match the files contained in two sets of folders or directories, adding new files, updating older files, and deleting unneeded ones automatically. Subdirectories are included in a mirror, with the option to omit them. Mirror choices have expanded in SecureFX 6.0. Where previous versions used only one command (the equivalent of 6.0's Mirror-both), Mirror-local, and Mirror-remote are added to let you to choose which machine is the source and which is the destination.

Here's how to set up mirroring:

  1. Select Quick Synchronize from the SecureFX Tools menu or use the Toolbar button.

  2. Choose the local folder and the remote session and folder that will be mirrored. (The remote session can be started from the Quick Synchronize dialog.)

  3. Then choose the direction to synchronize. If you use Mirror-both you will create a union of the files in both directories, so that both directories will contain all the files in either. Mirror-local means that if different versions of a file exist between the two folders, the file in the local folder will overwrite the one in the remote folder. The reverse would be true for the Mirror-remote choice.

    Mirror-local would be usual in the case of a webmaster, who works on a local copy of source files stored on C:\webfiles\newsite, and wants the fresh files to replace what is in the web server directory tree /webfiles/newsite (here with session name webserver). In this instance, if the same file exists in both directories, the remote file will be overwritten even if it is newer. Remote files that do not exist in the local directory will be deleted. The local directory will not be changed.

  4. Click OK to accept the setup. The Quick Synchronize window displays the results. You see the initial file comparison which shows whether files are common to source and destination or different, and if they will be uploaded, downloaded, overwritten, or deleted. A toolbar button allows you to intiate the transfer. After the transfer has been started, the window shows the file status as the transfer is in process, and finally the completion status. Transfers may also be halted mid-stream if needed using the Stop button.

The following screenshots show what our website file synchronization looks like before, during, and after synchronization.

Figure 1. Before synchronization
Figure 2. During synchronization
Figure 3. After synchronization

Mirroring with SFXCL.EXE (Windows version only)

Mirroring tasks can also be automated with the SFXCL.EXE command-line utility that is included with SecureFX for Windows. This would make sense if you didn't need to review the folder contents before committing to synchronizing files. SFXCL provides the same basic configuration choices through the /QuickSync option as SecureFX. The following is the basic SFXCL command-line syntax for QuickSync.

sfxcl /QuickSync <localpath> <sessionpath> <remotepath> <upload | download | mirror-both | mirror-local | mirror-remote>

The following command line would be used to mirror the website from our local folder in the hypothetical website maintenance example.

SFXCL.exe /QuickSync "C:\webfiles\newsite\" "/webserver" "/webfiles/newsite" mirror-local

To learn more about the Quick Synchronize feature and mirroring in SecureFX, see the Options Group section of the Quick Synchronize Dialog topic in the SecureFX program Help file.