By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,052 Members | 1,551 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,052 IT Pros & Developers. It's quick & easy.

Make Directory Tree

P: n/a
The following will create a directory if one is specified (e.g.,
ftp://ftp.domain.com/one/)

public void DirectoryMake(string strRemote, string strUsername, string
strPassword )

{

string[] strWork = strRemote.Split( '/' );

if ( strWork.Length != 2 )

{

MessageBox.Show( strWork.Length.ToString( ) );

FtpWebRequest req = (FtpWebRequest)FtpWebRequest.Create(c_strFtp +
strRemote );

req.Credentials = new NetworkCredential(strUsername, strPassword );

req.Method = WebRequestMethods.Ftp.MakeDirectory;

FtpWebResponse resp = (FtpWebResponse)req.GetResponse();

resp.Close( );

}

}

Is there an example of ...

1. How to test if a directory exists?

2. How to add sub directories (i.e., ftp://ftp.doman.com/one/two/three/)
--
-- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
--

Sep 30 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.