Idan Zipris

Hi,

I downloaded the "FTP Client Library" from here, and I want to download all the files in some directory on my FTP account via this class.

I tried a few ways, but I didn't success.

I Hope somebody can help me.

Idan.




Re: .NET Framework Networking and Communication Help with "FTP Client Library"

Idan Zipris

Nobody can help me

I just want to download the files from some directory on my FTP server with this class.






Re: .NET Framework Networking and Communication Help with "FTP Client Library"

hammerstein06

What code have you got so far

What specifically are you having problems with The author includes a CHM with how to implement.





Re: .NET Framework Networking and Communication Help with "FTP Client Library"

Idan Zipris

I tried to use the FTP.FTPfileinfo method, order to get the name of each file, but I got an error says that I didn't use correctly the parameter "line".






Re: .NET Framework Networking and Communication Help with "FTP Client Library"

Idan Zipris

Code Block
OpenFTP.FTP f = new OpenFTP.FTP();
f.Connect("server", "username", "password");
f.ChangeDirectory("");
// Console.Write("{0}", f.Files.Count);

for(int i = 0; i < f.Files.Count; i++)
{
f.Files.Download(f.Files[i].FileName, "C:\\Test\\" + f.Files[i].FileName);
while (!f.Files.DownloadComplete)
{
Console.WriteLine("Downloading: TotalBytes: " + f.Files.TotalBytes.ToString() + ", : PercentComplete: " + f.Files.PercentComplete.ToString());
}
}



Here is my code.
Right now it's downloading only the first file.
There is some way to do the download with foreach statement
Something like:
foreach (file in GetFiles)
{
file.download;
}

Thanks.






Re: .NET Framework Networking and Communication Help with "FTP Client Library"

hammerstein06

Are you sure that f.Files.Count is actually more than 1 What sort of debugging you done on this It looks ok.





Re: .NET Framework Networking and Communication Help with "FTP Client Library"

Idan Zipris

When I'm writing:

Code Block

Console.Write("{0}", f.Files.Count);

The output is 9.






Re: .NET Framework Networking and Communication Help with "FTP Client Library"

hammerstein06

Ok, have you put a console output in the for loop and shown that it's finding the other files





Re: .NET Framework Networking and Communication Help with "FTP Client Library"

Idan Zipris

Yes, It finding all the files.

When I'm writing:

Code Block

Console.Write(f.Files[i].FileName + Environment.NewLine);

The output is the name of each file.