Description
| Simple example to download a file from an SFTP server.
|
---|---|
Example
| Sub Main
Dim success As Long
SFTP.Hostname = "SFTP.chilkatsoft.com"
SFTP.Username = "****"
SFTP.Password = "****"
' The default data transfer mode is "Active" as opposed to "Passive".
' Connect and login to the SFTP server.
success = SFTP.Connect()
If (success <> 1) Then
MsgBox SFTP.LastErrorText
Exit Sub
End If
' Change to the remote directory where the file will be uploaded.
success = SFTP.ChangeRemoteDir("junk")
If (success <> 1) Then
MsgBox SFTP.LastErrorText
Exit Sub
End If
' Download a file.
Dim localFilename As String
localFilename = "hamlet.xml"
Dim remoteFilename As String
remoteFilename = "hamlet.xml"
success = SFTP.GetFile(remoteFilename,localFilename)
If (success <> 1) Then
MsgBox SFTP.LastErrorText
Exit Sub
End If
SFTP.Disconnect
MsgBox "File Uploaded!"
End Sub
|