Table of Contents

Class DirectoryInfo

Namespace
CMS.IO
Assembly
CMS.IO.dll

Exposes instance methods for creating, moving, and enumerating through directories and subdirectories.

public abstract class DirectoryInfo
Inheritance
object
DirectoryInfo
Derived
Extension Methods

Constructors

DirectoryInfo()

Creates new instance.

protected DirectoryInfo()

Properties

CreationTime

Creation time.

public abstract DateTime CreationTime { get; set; }

Property Value

DateTime

Exists

Whether directory exists.

public abstract bool Exists { get; set; }

Property Value

bool

FullName

Full name of directory (whole path).

public abstract string FullName { get; set; }

Property Value

string

LastWriteTime

Last write time to directory.

public abstract DateTime LastWriteTime { get; set; }

Property Value

DateTime

Name

Name of directory (without path).

public abstract string Name { get; set; }

Property Value

string

Parent

Parent directory.

public abstract DirectoryInfo Parent { get; }

Property Value

DirectoryInfo

Methods

CreateSubdirectory(string)

Creates subdirectory.

public DirectoryInfo CreateSubdirectory(string subdir)

Parameters

subdir string

Subdirectory to create

Returns

DirectoryInfo

CreateSubdirectoryInternal(string)

Creates subdirectory.

protected abstract DirectoryInfo CreateSubdirectoryInternal(string subdir)

Parameters

subdir string

Subdirectory to create

Returns

DirectoryInfo

Delete()

Deletes directory.

public void Delete()

DeleteInternal()

Deletes directory.

protected abstract void DeleteInternal()

EnumerateDirectories()

Returns an enumerable collection of directory information in the current directory.

public IEnumerable<DirectoryInfo> EnumerateDirectories()

Returns

IEnumerable<DirectoryInfo>

An enumerable collection of directories in the current directory.

EnumerateDirectories(string)

Returns an enumerable collection of directory information that matches a specified search pattern.

public IEnumerable<DirectoryInfo> EnumerateDirectories(string searchPattern)

Parameters

searchPattern string

Search pattern.

Returns

IEnumerable<DirectoryInfo>

An enumerable collection of directories that matches searchPattern.

EnumerateDirectories(string, SearchOption)

Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.

public IEnumerable<DirectoryInfo> EnumerateDirectories(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern.

searchOption SearchOption

One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.

Returns

IEnumerable<DirectoryInfo>

An enumerable collection of directories that matches searchPattern and searchOption.

EnumerateDirectoriesInternal(string, SearchOption)

Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.

protected abstract IEnumerable<DirectoryInfo> EnumerateDirectoriesInternal(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern.

searchOption SearchOption

One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.

Returns

IEnumerable<DirectoryInfo>

An enumerable collection of directories that matches searchPattern and searchOption.

EnumerateFiles()

Returns an enumerable collection of file information in the current directory.

public IEnumerable<FileInfo> EnumerateFiles()

Returns

IEnumerable<FileInfo>

An enumerable collection of the files in the current directory.

EnumerateFiles(string)

Returns an enumerable collection of file information that matches a search pattern.

public IEnumerable<FileInfo> EnumerateFiles(string searchPattern)

Parameters

searchPattern string

Search pattern.

Returns

IEnumerable<FileInfo>

An enumerable collection of files that matches searchPattern.

EnumerateFiles(string, SearchOption)

Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.

public IEnumerable<FileInfo> EnumerateFiles(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern.

searchOption SearchOption

One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.

Returns

IEnumerable<FileInfo>

An enumerable collection of files that matches searchPattern and searchOption.

EnumerateFilesInternal(string, SearchOption)

Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.

protected abstract IEnumerable<FileInfo> EnumerateFilesInternal(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern.

searchOption SearchOption

One of the enumeration values that specifies whether the search operation should include only the current directory or all subdirectories.

Returns

IEnumerable<FileInfo>

An enumerable collection of files that matches searchPattern and searchOption.

GetDirectories()

Returns the subdirectories of the current directory.

public DirectoryInfo[] GetDirectories()

Returns

DirectoryInfo[]

GetDirectories(string)

Returns the subdirectories of the current directory.

public DirectoryInfo[] GetDirectories(string searchPattern)

Parameters

searchPattern string

Search pattern

Returns

DirectoryInfo[]

GetDirectories(string, SearchOption)

Returns an array of directories in the current DirectoryInfo matching the given search criteria and using a value to determine whether to search subdirectories.

public DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern

searchOption SearchOption

Specifies whether to search the current directory, or the current directory and all subdirectories.

Returns

DirectoryInfo[]

GetDirectoriesInternal(string, SearchOption)

Returns an array of directories in the current DirectoryInfo matching the given search criteria and using a value to determine whether to search subdirectories.

protected abstract DirectoryInfo[] GetDirectoriesInternal(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern

searchOption SearchOption

Specifies whether to search the current directory, or the current directory and all subdirectories.

Returns

DirectoryInfo[]

GetFiles()

Returns a file list from the current directory.

public FileInfo[] GetFiles()

Returns

FileInfo[]

GetFiles(string)

Returns a file list from the current directory.

public FileInfo[] GetFiles(string searchPattern)

Parameters

searchPattern string

Search pattern

Returns

FileInfo[]

GetFiles(string, SearchOption)

Returns a file list from the current directory.

public FileInfo[] GetFiles(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern

searchOption SearchOption

Search options

Returns

FileInfo[]

GetFilesInternal(string, SearchOption)

Returns a file list from the current directory.

protected abstract FileInfo[] GetFilesInternal(string searchPattern, SearchOption searchOption)

Parameters

searchPattern string

Search pattern

searchOption SearchOption

Search options

Returns

FileInfo[]

GetSearchCondition(string)

Returns search condition delegate.

protected Func<string, bool> GetSearchCondition(string searchPattern)

Parameters

searchPattern string

Can be a combination of literal and wildcard characters, but doesn't support regular expressions. Supports only * and ?

Returns

Func<string, bool>

New(string)

Creates new instance of directory info object.

public static DirectoryInfo New(string path)

Parameters

path string

Path to directory

Returns

DirectoryInfo