C# DirectoryInfo CreateSubdirectory(String)

Description

DirectoryInfo CreateSubdirectory(String) Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.

Syntax

DirectoryInfo.CreateSubdirectory(String) has the following syntax.


public DirectoryInfo CreateSubdirectory(
  string path
)

Parameters

DirectoryInfo.CreateSubdirectory(String) has the following parameters.

  • path - The specified path. This cannot be a different disk volume or Universal Naming Convention (UNC) name.

Returns

DirectoryInfo.CreateSubdirectory(String) method returns The last directory specified in path.

Example

The following example demonstrates creating a subdirectory.


using System;/*from ww  w. j a v  a 2  s  . com*/
using System.IO;

public class CreateSubTest 
{
    public static void Main() 
    {
        DirectoryInfo di = new DirectoryInfo("TempDir");

        DirectoryInfo dis = di.CreateSubdirectory("SubDir");

    }
}




















Home »
  C# Tutorial »
    System.IO »




BinaryReader
BinaryWriter
Directory
DirectoryInfo
DriveInfo
File
FileInfo
FileStream
MemoryStream
Path
StreamReader
StreamWriter
StringReader
StringWriter