Options = {
 StopOnTransferError       // boolean
 DownloadPolicy            // enum: NeverOverwrite, AlwaysOverwrite, OverwriteIfDiffSize, OverwriteIfNewer
 UploadPolicy              // enum: NeverOverwrite, AlwaysOverwrite, OverwriteIfDiffSize, OverwriteIfNewer
 OnDownloadGrantTo         // string (username of a user to whom AFT! will grant access to downloaded file(s)
 AdjustTimeOnDownload      // bool
 AdjustTimeOnUpload        // bool
 DownloadWithTempName      // bool
 UploadWithTempName        // bool
 DeleteSourceAfterDownload // bool
 DeleteSourceAfterUpload   // bool
 VersionedDownload         // bool
 VersionedUpload           // bool
 VersionsToKeepLocal       // integer - default: 3
 VersionsToKeepRemote      // integer - default: 3
 OTFE                      // bool
 OTFEKey                   // string
 OTFEKeyFromSecret         // string
}


Every client object, regardless of the file transfer protocol it implements, will have an Options property like the one described here above.

Here below you can find an explanation of what each one of such options means.


StopOnTransferError: if true, any upload or download operation will immediately terminate if a file transfer error occurs, otherwise (if false) Syncplify.me AFT! will try to keep uploading/downloading the remaining queued files; this property defaults to false.


DownloadPolicy is the policy that the client object will apply to all downloads, and specifically:

  • NeverOverwrite: if a file with the same name already exists on the local file system, it will not be downloaded (this is the default value)
  • AlwaysOverwrite: all files will always be downloaded, even if it means that local files are going to be overwritten
  • OverwriteIfDiffSize: if a local file with the same name exists, the remote file will be downloaded (overwriting the local one) only if the size is different
  • OverwriteIfNewer: if a local file with the same name exists, the remote file will be downloaded (overwriting the local one) only if the remote file is more recent (looking at the last modification date)


UploadPolicy is the policy that the client object will apply to all uploads, and specifically:

  • NeverOverwrite: if a file with the same name already exists on the remote file server, it will not be uploaded (this is the default value)
  • AlwaysOverwrite: all files will always be uploaded, even if it means that remote files are going to be overwritten
  • OverwriteIfDiffSize: if a remote file with the same name exists, the local file will be uploaded (overwriting the remote one) only if the size is different
  • OverwriteIfNewer: if a remote file with the same name exists, the local file will be uploaded (overwriting the remote one) only if the local file is more recent (looking at the last modification date)


OnDownloadGrantTo: when AFT! is running as a system service, all downloaded files will be owned by "System" (on Windows) or "root" (on Linux/POSIX systems). If you specify this option, then AFT! will grant access (in Windows) or ownership (in Linux/POSIX) to all downloaded files to the username specified by this option.


AdjustTimeOnDownload: if true, the last modification time of each downloaded file will be adjusted to match the last modification time of the original file on the remote file server; this property defaults to true.


AdjustTimeOnUpload: if true, the last modification time of each uploaded file will be adjusted to match the last modification time of the original file on the local file system; this property defaults to true.


DownloadWithTempName: if true, all downloads will be operated using a temporary file, and only after a successful and complete download the temporary file will be renamed to the actual original name of the downloaded file. This property defaults to false.


UploadWithTempName: if true, all uploads will be operated using a temporary file, and only after a successful and complete upload the temporary file will be renamed to the actual original name of the uploaded file. This property defaults to false.


DeleteSourceAfterDownload: if true, after a file has been successfully downloaded, the original file (on the remote file server) is deleted, effectively turning the download into a "file move" operation from the remote to the local side.


DeleteSourceAfterUpload: if true, after a file has been successfully uploaded, the original file (on the local file-system) is deleted, effectively turning the upload into a "file move" operation from the local to the remote side.

VersionedDownload: if true, and if the other options require the destination local file to be overwritten by the one that's being downloaded, this option instructs AFT! to automatically keep the old version of the same file in a ".ver" sub-directory of the current local directory. This property defaults to false.


VersionedUpload: if true, and if the other options require the destination remote file to be overwritten by the one that's being uploaded, this option instructs AFT! to automatically keep the old version of the same file in a ".ver" sub-directory of the current remote directory. This property defaults to false.


VersionsToKeepLocal: used in conjunction with VersionedDownload, this property indicates the number of older versions of each file that AFT! will keep in the local ".ver" sub-directory. Defaults to 3.


VersionsToKeepRemote: used in conjunction with VersionedUpload, this property indicates the number of older versions of each file that AFT! will keep in the remote ".ver" sub-directory. Defaults to 3.


OTFE: short for On-The-Fly-Encryption, this property indicated whether AFT! should encrypt files as they are uploaded to a remote file server, and decrypt them as they are downloaded back to the local storage. Defaults to false.


OTFEKey: a secret word, password or keyword, from which the encryption key will be derived, when the OTFE property is set to true. Please do not type your passwords or encryption keys in clear! Use GetSecret instead, or - even better - use the OTFEKeyFromSecret property here below.


OTFEKeyFromSecret: the name of a stored secret (read more about secrets) to be used as seed to derive the encryption key to be used by the On-The-Fly-Encryption algorithm when the OTFE property is set to true. If both the OTFEKeyFromSecret and OTFEKey properties are specified, the OTFEKeyFromSecret property prevails.


Example:

{
 var scli = new SftpClient();
 scli.Host = 'your.sftpserver.com:22';
 scli.User = 'someusername';
 scli.KeyFile = './my_id.rsa';
 scli.Options.UploadPolicy = NeverOverwrite;
 scli.Options.AdjustTimeOnUpload = false;
 scli.Options.StopOnTransferError = true;
 if (scli.Connect()) {
  // perform your file transfers...
  // ...
  // ...
  scli.Close();
 }
 scli = null
}