BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.Object

Provides information and performs operations on directories.

Implementations are required to preserve the case of file and directory path strings, and to be case sensitive if and only if the current platform is case-sensitive.

In most methods that accept arguments, the path can refer to a file or a directory.

- Method
  System.IO.DirectoryInfo `` A containing the path to be created. Creates the specified path and any additional parents if non-existant. A representing the created directory. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.IO.DirectoryInfo `` `` To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.Void `` A containing the name of the directory to delete. This directory must be writable and empty.

  Deletes the empty directory specified in .

  This method behaves identically to (, ).

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . The specified was not found. The directory specified by is read-only or is not empty. The caller does not have the required permission. The length of or the absolute path information for exceeds the system-defined maximum length. Requires permission to write to the specified directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` A containing the name of the directory to delete. This directory must be writable and cannot contain files unless is true. Specify to delete subdirectories and files in ; otherwise, specify .

  Deletes the specified directory and, if indicated, any subdirectories in the directory.

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . The specified was not found. The directory specified by is read-only, or is and is not an empty directory. The caller does not have the required permission. The length of or the absolute path information for exceeds the system-defined maximum length. Requires permission to write to the specified directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` `` To be added. To be added. To be added. To be added. To be added.
- Method
  4.0.0.0
  System.Collections.Generic.IEnumerable<System.String> `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  System.Boolean `` A containing the name of the directory to check.

  Returns a indicating whether the specified directory exists.

  if the caller has the required permissions and contains the name of an existing directory; otherwise, . If is , a zero-length string, or contains the name of a file, returns .

  If the caller does not have sufficient permissions to read the files in the directory specified by , no exception is thrown and the method returns regardless of the existence of .

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-defined invalid characters. The length of or the absolute path information for exceeds the system-defined maximum length. was not found. Requires permission to read the specified directory. See . 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Security.AccessControl.DirectorySecurity `` To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.Security.AccessControl.DirectorySecurity `` `` To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.DateTime `` A containing the name of the file or directory for which to obtain creation date and time information.

  Returns the creation date and time of the specified file or directory.

  A structure set to the creation date and time for the specified directory. This value is expressed in local time.

  Platforms that do not support this feature return .

  This method is equivalent to ().

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . The directory specified by was not found. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission. Requires permission to read the specified file or directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.DateTime `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String

  Returns the application's current working directory.

  A containing the path of the current working directory.

  Platforms that do not support this feature return .

  The caller does not have the required permission. Requires permission to access path information for the current directory. See The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` A containing the name of the directory for which an array of subdirectory names is returned.

  Returns the names of subdirectories in the specified directory.

  A array containing the names of subdirectories in .

  This method is identical to ( , "*").

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  The names returned by this method are prefixed with the directory information provided in .

  is . The caller does not have the required permission. is a zero-length string, contains only white space, or contains implementation-specific invalid characters. was not found. The length of or the absolute path information for exceeds the system-defined maximum length. is a file name. Requires permission to access path information for the specified directory and its subdirectories. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` `` A containing the starting location for the search. A containing the text pattern to match against the names of subdirectories of . cannot end with "..", or contain ".." followed by or .

  Returns the names of subdirectories in the specified directory that match the specified search pattern.

  A array containing the names of subdirectories of that match .

  The following wild card specifiers are permitted in :

  Wild card
  Description
  *
  Zero or more characters.
  ?
  Exactly one character.

  The period (".") character, if immediately followed by a wild card specifier, indicates that the period or the empty string matches the pattern. For example, "foo.*" and "foo.?" match "foo". Note that "foo.*" and "foo*" behave identically. If the period is not immediately followed by a wildcard, it has no special meaning (it represents a period).

  Characters other than the wild card specifiers represent themselves, for example, the string "*t" searches for all names in ending with the letter "t". The string "s*" searches for all names in beginning with the letter "s".

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  oris . The caller does not have permission to access the requested information.

  is a zero-length string, contains only white space, or contains implementation-specific invalid characters.

  does not contain a valid pattern.

  was not found. The length of or the absolute path information for exceeds the system-defined maximum length. is a file name. Requires permission to access path information for the specified directory and its subdirectories. See . The caller does not have permission to access the requested information. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.String `` A containing the name of a file or directory.

  Returns the path root component of the specified path.

  A containing the root information for the specified path.

  Platforms that do not support this feature return .

  This method obtains the full path information for , as returned by () and returns the path root component. The specified path is not required to exist.

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.

  is . The caller does not have the required permission. The length of or the absolute path information for exceeds the system-defined maximum length. Requires permission to access path information for the specified file or directory. See

  The following example demonstrates the method.

  `using System; using System.IO; class GetDirectoryTest { public static void Main() { string [] paths = { @"\ecmatest\examples\pathtests.txt", "pathtests.xyzzy", @"\", @"C:\", @"\\myserver\myshare\foo\bar\baz.txt" }; foreach (string pathString in paths) { string s = Directory.GetDirectoryRoot(pathString); Console.WriteLine("Path: {0} Directory Root is {1}",pathString, s== null? "null":s); } } }`

  The output is

  Path: \ecmatest\examples\pathtests.txt Directory Root is C:\

  Path: pathtests.xyzzy Directory Root is C:\

  Path: \ Directory Root is C:\

  Path: C:\ Directory Root is C:\

  Path: \\myserver\myshare\foo\bar\baz.txt Directory Root is \\myserver\myshare

  The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` A containing the name of the directory for which file names are returned.

  Returns the names of all files in the specified directory.

  A array containing the names of the files in the specified directory.

  Platforms that do not support this feature return .

  This method is identical to (, "*").

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is null.

  path is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.

  was not found. is a file name. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission. Requires permission to access path information for the specified directory and the files in that directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` `` A containing the name of the directory to search. A containing the text pattern to match against the names of files in . cannot end with "..", or contain ".." followed by or .

  Returns the names of files in the specified directory that match the specified search pattern.

  A array containing the names of files in the specified directory that match the specified search pattern.

  The following wild card specifiers are permitted in :

  Wild card
  Description
  *
  Zero or more characters.
  ?
  Exactly one character.

  The period (".") character, if immediately followed by a wild card specifier, indicates that the period or the empty string matches the pattern. For example, "foo.*" and "foo.?" match "foo". Note that "foo.*" and "foo*" behave identically. If the period is not immediately followed by a wildcard, it has no special meaning (it represents a period).

  Characters other than the wild card specifiers and the period always represent themselves, for example, the string "*t" searches for all names in ending with the letter "t". The string "s*" searches for all names in beginning with the letter "s".

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  or is .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.

  -or-

  does not contain a valid pattern.

  is an existing file name. The caller does not have the required permission. was not found. The length of or the absolute path information for exceeds the system-defined maximum length. Requires permission to access path information for the specified directory and the files in that directory. See The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.String[] `` A containing the name of the directory for which file and subdirectory names are returned.

  Returns the names of all files and subdirectories in the specified directory.

  A array containing the names of file system entries in the specified directory.

  This method is identical to (, "*").

  The names returned by this method are prefixed with the directory information provided in . The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is . is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. The caller does not have the required permission. was not found. The length of or the absolute path information for exceeds the system-defined maximum length. is a file name. Requires permission to access path information for the specified directory. See The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] `` `` A containing the name of the directory to search. A containing the text pattern for which to search. cannot end with "..", or contain ".." followed by or .

  Returns an array of file and directory names matching the specified search criteria.

  A array containing file and directory names matching the specified search criteria.

  The following wild card specifiers are permitted in :

  Wild card
  Description
  *
  Zero or more characters.
  ?
  Exactly one character.

  The period (".") character, if immediately followed by a wild card specifier, indicates that the period or the empty string matches the pattern. For example, "foo.*" and "foo.?" match "foo". Note that "foo.*" and "foo*" behave identically. If the period is not immediately followed by a wildcard, it has no special meaning (it represents a period).

  Characters other than the wild card specifiers represent themselves, for example, the string "*t" searches for all names in ending with the letter "t". The string "s*" searches for all names in beginning with the letter "s".

  The names returned by this method are prefixed with the directory information provided in . The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  or is .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters.

  -or-

  does not contain a valid pattern.

  The caller does not have the required permission. was not found. The length of or the absolute path information for exceeds the system-defined maximum length. is a file name. Requires permission to access path information for the specified directory. See The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  4.0.0.0
  System.String[] `` `` `` To be added. To be added. To be added. To be added. To be added. To be added.
- Method
  System.DateTime `` A containing the name of the file or directory for which to obtain access date and time information.

  Returns the date and time the specified file or directory was last accessed.

  A structure set to the date and time the specified file or directory was last accessed. This value is expressed in local time.

  Platforms that do not support this feature return .

  This method is equivalent to ().

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . The specified path was not found. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission. Requires permission to read the specified file or directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.DateTime `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.DateTime `` A containing the name of the file or directory for which to obtain modification date and time information.

  Returns the date and time the specified file or directory was last written to.

  A structure set to the date and time the specified file or directory was last written to. This value is expressed in local time.

  Platforms that do not support this feature return .

  This method is equivalent to ( ).

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . The specified path was not found. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission. Requires permission to read the specified file or directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.DateTime `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.String[] To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.IO.DirectoryInfo `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` A containing the name of the file or directory to move. A containing the new location for . This string cannot identify an existing file or directory.

  Moves a file or a directory and its contents to a new location.

  The argument cannot specify a location on a different disk or volume than . The and arguments cannot identify the same file or directory.

  This method throws a if, for example, you try to move "\mydir" to "\public", and "\public" already exists. You must specify "\public\mydir" as the .

  The and arguments are permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  or is a zero-length string, contains only white space, or contains implementation-specific invalid characters. or is . The caller does not have the required permission.

  An attempt was made to move a directory to a different volume,

  -or-

  already exists.

  -or-

  and refer to the same file or directory.

  was not found. The length or absolute path information for or exceeds the system-defined maximum length. Requires permission to read from and write to and . See , . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` To be added. To be added. To be added. To be added. 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` A containing the name of the file or directory for which to set the creation date and time information. A containing the value to set for the creation date and time of . This value is expressed in local time.

  Sets the creation date and time for the specified file or directory.

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  On platforms that do not support this feature, this method has no effect. If this feature is supported, the range of dates that is valid for this operation is implementation-specific.

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. specifies a value outside the range of date/times permitted for this operation. is . was not found. An I/O error occurred while performing the operation. The length of or the absolute path information for exceeds the system-defined maximum length. Requires permission to write to the specified file or directory. See . The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` A containing the path to which the current working directory is set.

  Sets the application's current working directory to the specified directory.

  When the application terminates, the working directory is restored to its original location (the directory where the process was started).

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  On platforms that do not support this feature, this method has no effect.

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . was not found. An I/O error occurred while performing the operation. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission to access unmanaged code. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` A containing the name of the file or directory for which to set the access date and time information. A containing the value to set for the access date and time of . This value is expressed in local time.

  Sets the date and time the specified file or directory was last accessed.

  The argument is permitted to specify relative or absolute path information. Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  On platforms that do not support this feature, this method has no effect. If this feature is supported, the range of dates that is valid for this operation is implementation-specific.

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . An I/O error occurred while performing the operation. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission. Requires permission to write to the specified file or directory. See . specifies a value outside the range of date/times permitted for this operation. was not found. The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` A containing the name of the directory for which to set the date and time information. A containing the value to set for the last write date and time of . This value is expressed in local time.

  Sets the date and time a directory was last written to.

  Relative path information is interpreted as relative to the current working directory. To obtain the current working directory, see .

  On platforms that do not support this feature, this method has no effect. If this feature is supported, the range of dates that is valid for this operation is implementation-specific.

  is a zero-length string, contains only white space, or contains one or more implementation-specific invalid characters. is . An I/O error occurred while performing the operation. The length of or the absolute path information for exceeds the system-defined maximum length. The caller does not have the required permission. Requires permission to write to the specified file. See . specifies a value outside the range of date/times permitted for this operation. was not found. The caller does not have the required permission. 0 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
0 System.Runtime.InteropServices.ComVisible(true)