[AccessD] Transferring Files via FTP

David Emerson newsgrps at dalyn.co.nz
Fri Oct 9 03:31:50 CDT 2020


I can't find any ping commands that accept the credentials.

I get the same problem when I try getting a list of files using this
function:

Function ListFTPFiles(strFTPLogin As String, strFTPPassword As String,
strDirectory As String) As Variant

    On Error GoTo Err_ListFTPFiles

    Const q As String * 1 = """"
    
    Dim sEXE As String, strList As String, strFiles() As String, x As Long,
ff As Long
    
    strList = TempDir() & "FTPCmds.tmp"
    ff = FreeFile
    
    Open strList For Output As #ff
    Print #ff, "open " & Nz(basCustomDLookUp("FTPSiteAddress",
"dbo.tlkpSystemSetting", "SYID = 1"), "")
    Print #ff, strFTPLogin
    Print #ff, strFTPPassword
    Print #ff, "cd " & strDirectory
    Print #ff, "ls . " & TempDir() & "webfiles.txt"
    Print #ff, "bye"
    Close #ff
    
    sEXE = Environ$("COMSPEC")
    sEXE = Left$(sEXE, Len(sEXE) - Len(Dir(sEXE)))
    sEXE = sEXE & "ftp.exe -s:" & q & strList & q
    ShellWait sEXE, vbHide
'    Kill strList
    ff = FreeFile
    Open TempDir() & "webfiles.txt" For Input As #ff
    While Not EOF(ff)
        x = x + 1
        ReDim Preserve strFiles(x)
        Line Input #1, strFiles(x)
    Wend
    Close #ff
    'Kill TempDir() & "webfiles.txt"
    ListFTPFiles = strFiles()

The webfiles.txt file is not being created.  The strDirectory ("EIEPin ")
exists and is off the root directory.  It also has files in it.

Do I need to send the port number through?  It should be 22.

David

-----Original Message-----
From: AccessD <accessd-bounces at databaseadvisors.com> On Behalf Of Gustav
Brock via AccessD
Sent: Friday, 9 October 2020 9:19 pm
To: Access Developers discussion and problem solving
<accessd at databaseadvisors.com>
Cc: Gustav Brock <gustav at cactus.dk>
Subject: Re: [AccessD] Transferring Files via FTP

Hi David

> I am able to connect using FileZilla.  But this includes a login and
password.

I guess you still need to pass your credentials.

/gustav 

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list