Hello everyone:

The problems is the following. I'm creating an specific program to upload to FTP on C#. That works perfectly. My problem is that i want to give the user the ability to change folders but so far I don't seem to find anything over the internet.

Can someone help me on this posting some code on how to get specifically folders on the FTP and not any other file. I want to put that info on a combobox, but that is not a problem. The thing is that I cannot find a way to do so. I tried GOOGLe, I tried several dll, libraries and all that but no success.

Hope someone can help.

Thanks in advance

Recommended Answers

All 3 Replies

Create a FtpWebRequest and set the Method property to what you want. Then call GetResponse() to get whatever data you need. Set the Method again, call GetResponse() again, etc. until you are done.

Create a FtpWebRequest and set the Method property to what you want. Then call GetResponse() to get whatever data you need. Set the Method again, call GetResponse() again, etc. until you are done.

First of all, thanks for your quick response.

The thing is that i don't see how can I filter folders. that is my problem. Cause I'm able to get the list of files but no folders. and what I need is to get the folders only.

I don't have an FTP server to test with so I'm kinda flying blind here, but you tried WebRequestMethods.Ftp.ListDirectory and WebRequestMethods.Ftp.ListDirectoryDetails?

If you do, can you post the response you get back from each?

There are also plenty of projects on the net for an FTP client written in C# (they use Sockets instead of FtpWebRequest).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.