Synchronization is one of the most complex operations ScriptFTP can carry out. This is because the command used for this purpose (SYNC) may sometimes appear complex and confusing. It is important to understand that in ScriptFTP synchronization can only be a one-way operation. This means that depending on the SYNC method you choose ScriptFTP will upload new and modified local files to a remote directory *or* download new and modified remote files to a local directory. These tasks are mutually exclusive. Optionally SYNC can also delete orphaned files. Before you start wondering about the meaning of “orphaned” let us look at a very simple example:

# Connect to as mysuer
# Upload new and modified files from /www
# to C:\LocalWebFolder. Delete orphaned files
# Close the connection

Once you have clicked the Run button ScriptFTP will display the following messages:

Connecting to

Uploading temporary file to calculate server-client clock time difference.
Clock time difference is -7201 seconds.
Synchronizing remote directory /www from C:\LocalWebFolder
Deleting    (remote file is orphaned)       orphaned_file.txt
Uploading   (remote file not found)       about.html
Skipping    (remote file is uptodate)   back.jpg
Uploading   (remote file is older)        contact.html
Uploading   (remote file not found)       index.html
Skipping    (remote file is uptodate)   notes.txt


The remote file orphaned_file.txt has been deleted because it could not be found in C:\LocalWebFolder, this is why it is called an orphaned file. The next file about.html has been uploaded because it did not exist in the remote directory /www. When a file is found in both remote and local locations ScriptFTP can perform two actions: retransfer it or simply ignore it (skip). The choice of action depends on the file modification date. If the file is newer ScriptFTP will transfer it. As you can see a synchronization can take three different actions for each file: transfer, delete or skip. Thus ScriptFTP will achieve an exact copy of a local or remote directory by transferring only the files needed. The method by which ScriptFTP finds all modified files is comparing local and remote file modification time stamps. If the computer ScriptFTP is running on and the FTP server share exactly the same time (which usually never happens) ScriptFTP will only have to compare the time stamps of the files. In the real world with computers spread around the world having different local times, it is more complex to determine whether a remote file is older or newer than a given local one. In order to solve this time difference problem ScriptFTP has the ability to determine the time difference between server and client. This is what you will notice:

Uploading temporary file to calculate server-client clock time difference.
Clock time difference is 3684 seconds.

3684 seconds comprise approximately one hour. This is the server-client time difference. ScriptFTP will use this value to determine which file is older and will transfer it only if necessary.

Sometimes it may happen that ScriptFTP cannot determine this value. This is usually due to access restrictions. For example:

Uploading temporary file to calculate server-client clock time difference.
***** SYNC Error 550: Cannot upload temporary file.
***** The server said: Permission denied

In this case you will have to manually tell ScriptFTP the time difference using the SETCLOCKDIFF command:


For further information see SETCLOCKDIFF and  SYNC.