File Transfer Protocol (FTP)

FastTrack has full support for all common operations for handling files and directories on an FTP server. It also has a powerful FTP synchronization command named SyncFTPDir, which is similar to SyncDir.

SyncFTPDir can be used, for example, for a simple backup solution for offline computers for which we would not allow a VPN connection, such as home computers partly used for work related use - without installing any software on the FTP server or uploading computers. SyncFTPDir simply takes a source and destination as parameters:
SyncFTPDir C:\Temp,ftp://10.10.10.10/MyFiles
Most likely your FTP server requires you to log on. In the script editor you can press F8 to encrypt a password and then you simply add the user name and encrypted password:
SyncFTPDir C:\Temp,ftp://10.10.10.10/MyFiles,ftpuser, 79dOu1Mu5dcNCMMWnIA64A==

File Transfer Protocol (FTP)

SyncFTPDir in action

SyncFTPDir from a usage perspective works the same way as SyncDir. From a technical point of view, they have nothing in common and there are variations in execution behavior. FTP is an old protocol and there are numerous implementations of FTP servers, which means that (unlike the Windows file system) there are differences in behavior of various FTP servers. Basic things like time stamps and the ability to handle concurrent connections vary from FTP server to FTP server type. Because of this, SyncFTPDir (unlike SyncDir) needs an initial run to "learn" the FTP structure of the files. SyncFTPDir command will therefore always copy all files on the first run, but on subsequent runs with the same source and destination, SyncFTPDir will copy only changed or new files.

In the movie below, we are creating an offline backup solution over FTP. When it is executed on the admin computer, there are 532 files in the "My Documents" folder and 18 megabytes of data. On the initial run, there are no files in the destination. But if there were, the initial run would still have taken the same amount of time, as the command needs to "learn" about the destination files. But when the script is executed again, it drops from 14 seconds to 4 seconds, because none of the files have changed on the second run at either end.


The CopyFPTDir command will also work as a synchronization, but the difference is that SyncFTPDir will also delete files that no longer exist in the source.

We could expand the script in the movie a little and compile it into an exe file. We could give this exe file to offline users to whom we would not want to give full VPN access. Note that this is completely safe, as the credentials are within the exe file and the password is also encrypted in the script. The script will check that the user does not have more than 500MB of data to upload. You can insert this example in the script editor by selecting "FTP Backup" in the "New Script" window.

If Ask Do you want to backup your documents? Then

  If [DirSizeMB [UserDocumentsDir]]>500 Then

    ShowErrorMessage Backup is not allowed for over 500 megabytes of data.

  Else

    SyncFTPDir [UserDocumentsDir],ftp://10.10.10.10/Backups/[ComputerName],ftpuser,79dOu1Mu5dcNCMMWnIA64A==

    If Not LastFTPWasCancelled Then ShowMessage The backup is complete.

  End If

End If


Factoring in limitations of FTP

SyncFTPDir does not use the fancy performance features of SyncDir, such as multithreading, because the limitations would primarily be bandwidth and secondarily the relatively poor performance of the FTP protocol in general, where SyncDir use would be a matter of sheer I/O performance. When working with FTP, you should always use your common sense. For example - if we wanted to create the above backup solution, depending on the bandwidth and FTP server performance, it could actually prove quicker to simply compress all the user's files into a single zip file and upload the entire zip file. Such a script could look like the one below. Note that the zip file includes a password for additional security. You can insert this example in the script editor by selecting "FTP Zip Backup" in the "New Script" window.

If Ask Do you want to run a backup? Then

  SmallSplash Packing files....hang on

  Zip [UserDocumentsDir],[TempDir]\Backup.Zip,yHULrIV6BMkM7OsOiMgfdw==

  RemoveSmallSplash

  If [FileSizeMB [TempDir]\Backup.Zip]>500 Then

    ShowErrorMessage Backup is not allowed for over 500 megabytes of data.

  Else

    CopyFTPFile [TempDir]\Backup.Zip,ftp://10.10.10.10/Backups/[ComputerName].Zip,ftpuser,79dOu1Mu5dcNCMMWnIA64A==

  End If

  DeleteFile [TempDir]\Backup.Zip

End If


Cancellation

A cancellation button is shown by default on the user interface, when you use the SyncFTPDir, CopyFTPDir or CopyFTPFile commands. If you do not want a user interface, there are versions of these appended by "Hidden" in the command name. If you want the user inferface, but not the option to cancel, you can remove the button by using the DisableFTPCancel command. If you need to detect that a cancellation has happened in your script, you can check this with the LastFTPWasCancelled condition.

SyncFTPDir with cancel button
SyncFTPFile with cancel button

SyncFTPDir without cancel button
SyncFTPFile without cancel button


Rating: 5 out of 5

"Use this as a replacement for VBScript and PowerShell"

"It's easy to include attractive GUI elements in FastTrack scripts, beyond the basic dialog boxes and text input that VBScript offers ... Another powerful feature is the ability to distribute scripts as Windows Installer (.msi) or standard .exe files. Although interesting in its own right, this ability results in a much more intriguing capability: to repackage -- or wrap -- software installers as .msi files without using snapshots. If you've ever created an .msi installer file from before-and-after system snapshots, for use with a software distribution system such as Group Policy or SCCM, then you know how hit-and-miss the results can be."

Read full review


Rating: 8 out of 10

"Faster than the rest"

"We found the FastTrack syntax to be more transparent and easier to learn than Microsoft's PowerShell – the editor in particular provided good support in this regard. the Script Editor offers a large number of options from the command set through to simple output of graphical elements, which cannot be achieved at all with PowerShell or other solutions or only with a significantly greater level of effort."

"Anyone wanting to tackle the many hurdles in everyday admin and especially anyone for whom logon scripts and client automation is a priority will benefit from the variety of functions offered by FastTrack."

Review in English      Review in German