Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.9k views
in .NET FTP by (160 points)
Hi, I am trying to copy a series of files from an FTP to a local file, but I am taking the following error:

The given path's format is not supported.

Below the code used

string path = "D:\\Mitsat\\vale\\ftp\\arquivos\\";
string host = "xxxxxxxxxxx";
string user = "xxxxxxxxxxx";
string password = "xxxxxxxxxxx";

FTPClient ftp = null;

ftp = new FTPClient(host);
ftp.Login(user, password);

ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;

string[] files = ftp.Dir(".", true);
for (int i = 0; i < files.Length; i++)
{
    ftp.Get((path + files[i]), files[i]);
}


tks

3 Answers

0 votes
by (51.6k points)
Try using Dir(".", false).

Also, we recommend using FTPConnection rather than FTPClient as this is the new, more powerful, interface.

- Hans (EnterpriseDT)
0 votes
by (160 points)
Please help me
I have a problem for copy file de remote folder to local folder.

Error Code = 10060
Error Message = Unable to read data from the transport connection: An attempt to connect failed because the component has not responded connected \ r \ ncorretamente after a period of time or the established connection failed \ r \ nporque connected the host did not respond.

//CODE
string ftpServer = "ftp.myftp.com";
string ftpLogin = "myLogin";
string ftpPass = "myPass";
string folder = "myFolder";
string localPath = "D:\\"

FTPClient ftp = null;
ftp = new FTPClient(ftpServer);
ftp.Login(ftpLogin, ftpPass);


ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;

if (ftp.IsConnected == true)
{
   string[] files = ftp.Dir(folder, false);
        for (int i = 0; i < files.Length; i++)
        {
                if (files[i].ToLower() == "myFile.txt")
                 {
                           ftp.Get((localPath + files[i]), files[i]);
                 }
         }
}
0 votes
by (51.6k points)
Could you please enable logging at the DEBUG level and include the log in your reply. The Developer's Guide has instructions for how to enable logging.

- Hans (EnterpriseDT)

Categories

...