Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.8k views
in .NET FTP by (140 points)
I am trying to upload a series of files in a directory that begin with the letter "d". I am using the code listed below and it is completing through the code (displaying my message box) but the files do not get uploaded. However, if I hardcode a file name and use the same method, it works. I would really appreciate some help on this.

Private Sub FTPedt_net()

        Try
            'connect to ftp server
            Dim ftp As New FTPConnection
            ftp.ServerAddress = "ftp.test.com"
            ftp.UserName = "user"
            ftp.Password = "pass"
            ftp.Connect()
            ftp.TransferType = FTPTransferType.BINARY

            Dim strFiles() As String
            strFiles = ftp.GetFiles("d*")

            For Each strFile As String In strFiles
                ftp.UploadFile("C:\TEST\" & strFile, strFile)
            Next

            ftp.Close()

        Catch ex As Exception
            MessageBox.Show(ex.Message.ToString())
            Exit Sub
        End Try

        MsgBox("Files sent successfully", vbInformation, "FTP Success")

    End Sub

1 Answer

0 votes
by (51.6k points)
It may be that the server doesn't understand the wildcard. The "d*" argument is sent straight to the server, and there's no standard for specifying wildcards in the FTP protocol spec, so there's no guarantee that the server will understand it. If you post a log, we'll be able to see what the server's response it.

- Hans (EnterpriseDT)

Categories

...