469,300 Members | 2,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

FTP : Need code or method to Folder Exists or Not in ftp Server in c#

donilourdu
Hi,

I am Doni Agna Lourdu. I developeing a small Ftp server. I can able to upload file, Create folder to Ftp Server. I can also List directory details.

But I can able to tell Whether Folder Exsists or Not. So kindly tell me any code or idea for this.


with regards,
Doni
May 31 '07 #1
5 13722
SammyB
807 Expert 512MB
Hi,

I am Doni Agna Lourdu. I developeing a small Ftp server. I can able to upload file, Create folder to Ftp Server. I can also List directory details.

But I can able to tell Whether Folder Exsists or Not. So kindly tell me any code or idea for this.


with regards,
Doni
Just experiment. Doesn't responseText return an empty string if the folder does not exist?
May 31 '07 #2
sgotur
1
can you explain the process of creating a folder inside a FTP server?
Jan 15 '08 #3
Plater
7,872 Expert 4TB
Are you writing an FTP Server, or an FTP Client?
As an FTP server, you are in charge of making the directories, and thus you could use Directory.Exists() or any other method you chose since you are creating the server.

If you are creating a client, it is the server's responsibility to handle if the directory exists or not and respond to you with success or failure.
Jan 15 '08 #4
Thank you for your reply.
I am using FTP Client. First I need to share some thing with you . Then only you can understand better.

I need to upload large no of files. But Inside that folder there is possibility of folder with folders. Also I am uploading files one by one. For these resons only I need code to check Folder avilable or not and File avilable or not.
Looking for favorable reply

With regards,
Doni

Are you writing an FTP Server, or an FTP Client?
As an FTP server, you are in charge of making the directories, and thus you could use Directory.Exists() or any other method you chose since you are creating the server.

If you are creating a client, it is the server's responsibility to handle if the directory exists or not and respond to you with success or failure.
Jan 18 '08 #5
We can create folder in FTP using

folder creation method.

FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + dirName));
reqFTP.Method = WebRequestMethods.Ftp.MakeDirectory; reqFTP.UseBinary = true;
reqFTP.Credentials = new NetworkCredential(ftpUserID, ftpPassword);
FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
Stream ftpStream = response.GetResponseStream();

ftpStream.Close();
response.Close();


can you explain the process of creating a folder inside a FTP server?
Jan 18 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Mike Button | last post: by
2 posts views Thread by Mark | last post: by
1 post views Thread by BobAchgill | last post: by
46 posts views Thread by Bruce W. Darby | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.