THE INFORMATION IN THIS ARTICLE APPLIES TO:
- Secure FTP Server, all versions
You can compress and encrypt files after transferring them by using GlobalSCAPE Secure FTP Server's Custom Site Commands. The benefits of encrypting files prior to or after transfer depends on the circumstances and level of trust for the particular host. You can also encrypt and compress files before transfer using GlobalSCAPE's CuteZIP and CuteFTP Pro.
In the example script below, an entire folder (including sub-folders) is compressed, encrypted (using Twofish 128 bit encryption) and then transferred via regular FTP to an FTP server. Since the archived file is encrypted, there is no need to connect using SSL, OTP, or SSH2 unless you wished to also protect the login process.
Dim WshShell, MySite, Return
Set WshShell = CreateObject("WScript.Shell") 'Window's Scripting Host shell object
'next line calls the run method of the WSH shell object. It returns true once CuteZIP does its thing.
'The complete command line instructions for CuteZIP are located here.
If Return = WshShell.run ("c:\progra~1\global~1\CuteZIP\cutezip.exe -c -p12345 c:\archive c:\temp", 0, true) Then
Set MySite = CreateObject("CuteFTPPro.TEConnection")
MySite.Option ("ThrowError") = True
MySite.Host = "ftp://user:email@example.com" 'one of the ways to connect using the Pro TE
MySite.Upload "c:\archive.zip" 'upload the new archive, then check to see if it made it up to the server.
if not CBool(MySite.RemoteExists("\archive.zip")) then
MsgBox "Failed to Upload, Exiting!"
MsgBox "Compression and Encryption Failed, Exiting!"
You can optionally protect the FTP login by connecting with SSL, SSH2 or OTP using CuteFTP Pro's Transfer Engine (GlobalSCAPE's Secure FTP Server supports SSL, OTP, and SSH2 logins). Use the Protocol property to set the connection type prior to calling MySite.Host and MySite.Connect.