Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INET control SFTP wont get files

Status
Not open for further replies.

SteveMac32

Programmer
Jan 25, 2002
74
0
0
GB
Hi all really hope you can help me out here..

I know Inet is not the best but this is protocols they use and they won’t let me change them...

That said I have been working on this for hours and about to give up, if only I could, I can’t seem to get or put files onto the sFTP site even though I have all the correct user name and p/w.

here is my code snippet

Private Sub FTPFile()

With frmInet.Inet1
.Protocol = icFTP
.RemoteHost = cHost
.UserName = cUser
.Password = cPassword
.RemotePort = "21"
.RequestTimeout = 500

If gblnImport Then
' as far as I know it goes to htl1x/in/ or at least it does when I connect through Filezilla
.Execute , "get models.txt \\global\Files\Imports\Temp_ImportData\ImportTest.txt"
Else
.Execute , "cd /htl1x/out/"
While .StillExecuting
DoEvents
Wend
.Execute , "put \\global\Files\Exports\Temp_ExportData\ExportTest.txt"
End If
End With
End Sub


When I add
'Read the data on the site
Dim vdata As Variant
.Execute , "DIR"
vdata = .GetChunk(1024, icString)
Debug.Print vdata

It returns all the correct data

I just can’t work out what is wrong any ideas, does the code look ok????
 
SFTP uses port 22, but it doesn't matter. INet can't handle the SFTP protocol or the FTPS protocol, only regular FTP.
 
Hi all sorry I need to raise this up again I am now connecting to a FTP not SFTP so i just need a sanity check on the above code, I know its correct well I think i do, Would you agree?

If this code is correct it means I can move on and look for the problem elsewhere because when I run either the "get" or the "put" no files appear.
 
oops sorry I have amended the Put to:

.Execute , "put \\global\Files\Exports\Temp_ExportData\ExportTest.txt ExportTest.txt[\b]"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top