Make Directory Tree

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Thom Little

    Make Directory Tree

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



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

    {

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

    if ( strWork.Length != 2 )

    {

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

    FtpWebRequest req = (FtpWebRequest) FtpWebRequest.C reate(c_strFtp +
    strRemote );

    req.Credentials = new NetworkCredenti al(strUsername, strPassword );

    req.Method = WebRequestMetho ds.Ftp.MakeDire ctory;

    FtpWebResponse resp = (FtpWebResponse )req.GetRespons e();

    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.
    --



Working...