Click or drag to resize

DirectoryInfo Class

Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.
Inheritance Hierarchy

Namespace:  Alphaleonis.Win32.Filesystem
Assembly:  AlphaFS (in AlphaFS.dll) Version: 2.2
Syntax
[SerializableAttribute]
public sealed class DirectoryInfo : FileSystemInfo

The DirectoryInfo type exposes the following members.

Constructors
  NameDescription
Public methodDirectoryInfo(String)
Initializes a new instance of the DirectoryInfo class on the specified path.
Public methodDirectoryInfo(String, PathFormat)
[AlphaFS] Initializes a new instance of the DirectoryInfo class on the specified path.
Public methodDirectoryInfo(KernelTransaction, String)
[AlphaFS] Initializes a new instance of the DirectoryInfo class on the specified path.
Public methodDirectoryInfo(KernelTransaction, String, PathFormat)
[AlphaFS] Initializes a new instance of the DirectoryInfo class on the specified path.
Top
Properties
  NameDescription
Public propertyAttributes
Gets or sets the attributes for the current file or directory.
(Inherited from FileSystemInfo.)
Public propertyCreationTime
Gets or sets the creation time of the current file or directory.
(Inherited from FileSystemInfo.)
Public propertyCreationTimeUtc
Gets or sets the creation time, in coordinated universal time (UTC), of the current file or directory.
(Inherited from FileSystemInfo.)
Protected propertyDisplayPath
Returns the path as a string.
(Inherited from FileSystemInfo.)
Public propertyEntryInfo
[AlphaFS] Gets the instance of the FileSystemEntryInfo class.
(Inherited from FileSystemInfo.)
Public propertyExists
Gets a value indicating whether the directory exists.
(Overrides FileSystemInfoExists.)
Public propertyExtension
Gets the string representing the extension part of the file.
(Inherited from FileSystemInfo.)
Public propertyFullName
Gets the full path of the directory or file.
(Inherited from FileSystemInfo.)
Protected propertyIsDirectory
[AlphaFS] The initial "IsDirectory" indicator that was passed to the constructor.
(Inherited from FileSystemInfo.)
Public propertyLastAccessTime
Gets or sets the time the current file or directory was last accessed.
(Inherited from FileSystemInfo.)
Public propertyLastAccessTimeUtc
Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.
(Inherited from FileSystemInfo.)
Public propertyLastWriteTime
Gets or sets the time when the current file or directory was last written to.
(Inherited from FileSystemInfo.)
Public propertyLastWriteTimeUtc
Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.
(Inherited from FileSystemInfo.)
Protected propertyLongFullName
The full path of the file system object in Unicode (LongPath) format.
(Inherited from FileSystemInfo.)
Public propertyName
Gets the name of this DirectoryInfo instance.
(Overrides FileSystemInfoName.)
Public propertyParent
Gets the parent directory of a specified subdirectory.
Public propertyRoot
Gets the root portion of the directory.
Protected propertyTransaction
[AlphaFS] Represents the KernelTransaction that was passed to the constructor.
(Inherited from FileSystemInfo.)
Top
Methods
  NameDescription
Public methodCompress
[AlphaFS] Compresses a directory using NTFS compression.
Public methodCompress(DirectoryEnumerationOptions)
[AlphaFS] Compresses a directory using NTFS compression.
Public methodCopyTo(String)
[AlphaFS] Copies a DirectoryInfo instance and its contents to a new path.
Remarks

Use this method to prevent overwriting of an existing directory by default.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.
Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, PathFormat)
[AlphaFS] Copies a DirectoryInfo instance and its contents to a new path.
Remarks

Use this method to prevent overwriting of an existing directory by default.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, Boolean)
[AlphaFS] Copies a DirectoryInfo instance and its contents to a new path.
Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, PathFormat)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.
Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, Boolean)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.
Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, Boolean, PathFormat)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.
Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, CopyMoveProgressRoutine, Object)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.

and the possibility of notifying the application of its progress through a callback function.

Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, Boolean, PathFormat)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.
Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, CopyMoveProgressRoutine, Object, PathFormat)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.

and the possibility of notifying the application of its progress through a callback function.

Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, Boolean, CopyMoveProgressRoutine, Object)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.

and the possibility of notifying the application of its progress through a callback function.

Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCopyTo(String, CopyOptions, Boolean, CopyMoveProgressRoutine, Object, PathFormat)
[AlphaFS] Copies an existing directory to a new directory, allowing the overwriting of an existing directory, CopyOptions can be specified.

and the possibility of notifying the application of its progress through a callback function.

Remarks

Option NoBuffering is recommended for very large file transfers.

Use this method to allow or prevent overwriting of an existing directory.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodCountFileSystemObjects(DirectoryEnumerationOptions)
[AlphaFS] Counts file system objects: files, folders or both) in a given directory.
Public methodCountFileSystemObjects(String, DirectoryEnumerationOptions)
[AlphaFS] Counts file system objects: files, folders or both) in a given directory.
Public methodCreate
Creates a directory.
Public methodCreate(Boolean)
[AlphaFS] Creates a directory using a DirectorySecurity object.
Public methodCreate(DirectorySecurity)
Creates a directory using a DirectorySecurity object.
Public methodCreate(DirectorySecurity, Boolean)
[AlphaFS] Creates a directory using a DirectorySecurity object.
Public methodCreateJunction(String)
[AlphaFS] Converts the DirectoryInfo instance into a directory junction instance (similar to CMD command: "MKLINK /J").
Remarks

 

The directory must be empty and reside on a local volume.

 

MSDN: A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories,

and a junction can link directories located on different local volumes on the same computer.

Otherwise, junctions operate identically to hard links. Junctions are implemented through reparse points.

Public methodCreateJunction(String, PathFormat)
[AlphaFS] Converts the DirectoryInfo instance into a directory junction instance (similar to CMD command: "MKLINK /J").
Remarks

 

The directory must be empty and reside on a local volume.

 

MSDN: A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories,

and a junction can link directories located on different local volumes on the same computer.

Otherwise, junctions operate identically to hard links. Junctions are implemented through reparse points.

Public methodCreateJunction(String, Boolean)
[AlphaFS] Converts the DirectoryInfo instance into a directory junction instance (similar to CMD command: "MKLINK /J").
Remarks

 

The directory must be empty and reside on a local volume.

 

MSDN: A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories,

and a junction can link directories located on different local volumes on the same computer.

Otherwise, junctions operate identically to hard links. Junctions are implemented through reparse points.

Public methodCreateJunction(String, Boolean, PathFormat)
[AlphaFS] Converts the DirectoryInfo instance into a directory junction instance (similar to CMD command: "MKLINK /J").
Remarks

 

The directory must be empty and reside on a local volume.

 

MSDN: A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories,

and a junction can link directories located on different local volumes on the same computer.

Otherwise, junctions operate identically to hard links. Junctions are implemented through reparse points.

Public methodCreateJunction(String, Boolean, Boolean)
[AlphaFS] Converts the DirectoryInfo instance into a directory junction instance (similar to CMD command: "MKLINK /J").
Remarks

 

The directory must be empty and reside on a local volume.

 

MSDN: A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories,

and a junction can link directories located on different local volumes on the same computer.

Otherwise, junctions operate identically to hard links. Junctions are implemented through reparse points.

Public methodCreateJunction(String, Boolean, Boolean, PathFormat)
[AlphaFS] Converts the DirectoryInfo instance into a directory junction instance (similar to CMD command: "MKLINK /J").
Remarks

 

The directory must be empty and reside on a local volume.

 

MSDN: A junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories,

and a junction can link directories located on different local volumes on the same computer.

Otherwise, junctions operate identically to hard links. Junctions are implemented through reparse points.

Public methodCreateObjRef
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
Public methodCreateSubdirectory(String)
Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.
Public methodCreateSubdirectory(String, Boolean)
[AlphaFS] Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.
Public methodCreateSubdirectory(String, DirectorySecurity)
Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.
Public methodCreateSubdirectory(String, DirectorySecurity, Boolean)
[AlphaFS] Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.
Public methodCreateSubdirectory(String, String, Boolean)
[AlphaFS] Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.
Public methodCreateSubdirectory(String, String, DirectorySecurity, Boolean)
[AlphaFS] Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the DirectoryInfo class.
Public methodDecompress
[AlphaFS] Decompresses an NTFS compressed directory.
Public methodDecompress(DirectoryEnumerationOptions)
[AlphaFS] Decompresses an NTFS compressed directory.
Public methodDecrypt
[AlphaFS] Decrypts a directory that was encrypted by the current account using the Encrypt method.
Public methodDecrypt(Boolean)
[AlphaFS] Decrypts a directory that was encrypted by the current account using the Encrypt method.
Public methodDelete
Deletes this DirectoryInfo if it is empty.
(Overrides FileSystemInfoDelete.)
Public methodDelete(Boolean)
Deletes this instance of a DirectoryInfo, specifying whether to delete subdirectories and files.
Public methodDelete(Boolean, Boolean)
[AlphaFS] Deletes this instance of a DirectoryInfo, specifying whether to delete files and subdirectories.
Public methodDelete(Boolean, Boolean, Boolean)
[AlphaFS] Deletes this instance of a DirectoryInfo, specifying whether to delete files and subdirectories.
Public methodDeleteEmptySubdirectories
[AlphaFS] Deletes empty subdirectories from the DirectoryInfo instance.
Public methodDeleteEmptySubdirectories(Boolean)
[AlphaFS] Deletes empty subdirectories from the DirectoryInfo instance.
Public methodDeleteEmptySubdirectories(Boolean, Boolean)
[AlphaFS] Deletes empty subdirectories from the DirectoryInfo instance.
Public methodDeleteJunction
[AlphaFS] Removes the directory junction.

 

Remarks

Only the directory junction is removed, not the target.

Public methodDeleteJunction(Boolean)
[AlphaFS] Removes the directory junction.

 

Remarks

Only the directory junction is removed, not the target.

Public methodDisableCompression
[AlphaFS] Disables compression of the specified directory and the files in it.
Public methodDisableEncryption
[AlphaFS] Disables encryption of the specified directory and the files in it. It does not affect encryption of subdirectories below the indicated directory.
Public methodEnableCompression
[AlphaFS] Enables compression of the specified directory and the files in it.
Public methodEnableEncryption
[AlphaFS] Enables encryption of the specified directory and the files in it. It does not affect encryption of subdirectories below the indicated directory.
Public methodEncrypt
[AlphaFS] Encrypts a directory so that only the account used to encrypt the directory can decrypt it.
Public methodEncrypt(Boolean)
[AlphaFS] Decrypts a directory that was encrypted by the current account using the Encrypt method.
Public methodEnumerateAlternateDataStreams
[AlphaFS] Returns an enumerable collection of AlternateDataStreamInfo instances for the directory.
Public methodEnumerateDirectories
Returns an enumerable collection of directory information in the current directory.
Public methodEnumerateDirectories(String)
Returns an enumerable collection of directory information that matches a specified search pattern.
Public methodEnumerateDirectories(DirectoryEnumerationOptions)
[AlphaFS] Returns an enumerable collection of directory information in the current directory.
Public methodEnumerateDirectories(String, DirectoryEnumerationOptions)
Returns an enumerable collection of directory information that matches a specified search pattern.
Public methodEnumerateDirectories(String, SearchOption)
Returns an enumerable collection of directory information that matches a specified search pattern and search subdirectory option.
Public methodEnumerateFiles
Returns an enumerable collection of file information in the current directory.
Public methodEnumerateFiles(String)
Returns an enumerable collection of file information that matches a search pattern.
Public methodEnumerateFiles(DirectoryEnumerationOptions)
Returns an enumerable collection of file information in the current directory.
Public methodEnumerateFiles(String, DirectoryEnumerationOptions)
Returns an enumerable collection of file information that matches a search pattern.
Public methodEnumerateFiles(String, SearchOption)
Returns an enumerable collection of file information that matches a specified search pattern and search subdirectory option.
Public methodEnumerateFileSystemInfos
Returns an enumerable collection of file system information in the current directory.
Public methodEnumerateFileSystemInfos(String)
Returns an enumerable collection of file system information that matches a specified search pattern.
Public methodEnumerateFileSystemInfos(DirectoryEnumerationOptions)
[AlphaFS] Returns an enumerable collection of file system information in the current directory.
Public methodEnumerateFileSystemInfos(String, DirectoryEnumerationOptions)
[AlphaFS] Returns an enumerable collection of file system information that matches a specified search pattern.
Public methodEnumerateFileSystemInfos(String, SearchOption)
Returns an enumerable collection of file system information that matches a specified search pattern and search subdirectory option.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from FileSystemInfo.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetAccessControl
Gets a DirectorySecurity object that encapsulates the access control list (ACL) entries for the directory described by the current DirectoryInfo object.
Public methodGetAccessControl(AccessControlSections)
Gets a DirectorySecurity object that encapsulates the specified type of access control list (ACL) entries for the directory described by the current DirectoryInfo object.
Public methodGetDirectories
Returns the subdirectories of the current directory.
Public methodGetDirectories(String)
Returns an array of directories in the current DirectoryInfo matching the given search criteria.
Public methodGetDirectories(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 methodGetFileId
[AlphaFS] Gets the unique identifier for the directory. The identifier is composed of a 64-bit volume serial number and 128-bit file system entry identifier.
Public methodGetFiles
Returns a file list from the current directory.
Public methodGetFiles(String)
Returns a file list from the current directory matching the given search pattern.
Public methodGetFiles(String, SearchOption)
Returns a file list from the current directory matching the given search pattern and using a value to determine whether to search subdirectories.
Public methodGetFileSystemInfos
Returns an array of strongly typed FileSystemInfo entries representing all the files and subdirectories in a directory.
Public methodGetFileSystemInfos(String)
Retrieves an array of strongly typed FileSystemInfo objects representing the files and subdirectories that match the specified search criteria.
Public methodGetFileSystemInfos(String, SearchOption)
Retrieves an array of strongly typed FileSystemInfo objects representing the files and subdirectories that match the specified search criteria.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from FileSystemInfo.)
Public methodGetLifetimeService
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodInitializeLifetimeService
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodMemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
Public methodMoveTo(String)
Moves a DirectoryInfo instance and its contents to a new path.
Remarks

Use this method to prevent overwriting of an existing directory by default.

This method does not work across disk volumes.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodMoveTo(String, MoveOptions)
[AlphaFS] Moves a DirectoryInfo instance and its contents to a new path, MoveOptions can be specified.
Remarks

Use this method to allow or prevent overwriting of an existing directory.

This method does not work across disk volumes unless moveOptions contains CopyAllowed.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodMoveTo(String, PathFormat)
[AlphaFS] Moves a DirectoryInfo instance and its contents to a new path.
Remarks

Use this method to prevent overwriting of an existing directory by default.

This method does not work across disk volumes.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodMoveTo(String, MoveOptions, PathFormat)
[AlphaFS] Moves a DirectoryInfo instance and its contents to a new path, MoveOptions can be specified.
Remarks

Use this method to allow or prevent overwriting of an existing directory.

This method does not work across disk volumes unless moveOptions contains CopyAllowed.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodMoveTo(String, MoveOptions, CopyMoveProgressRoutine, Object)
[AlphaFS] Moves a DirectoryInfo instance and its contents to a new path, MoveOptions can be specified,

and the possibility of notifying the application of its progress through a callback function.

Remarks

Use this method to allow or prevent overwriting of an existing directory.

This method does not work across disk volumes unless moveOptions contains CopyAllowed.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodMoveTo(String, MoveOptions, CopyMoveProgressRoutine, Object, PathFormat)
[AlphaFS] Moves a DirectoryInfo instance and its contents to a new path, MoveOptions can be specified,

and the possibility of notifying the application of its progress through a callback function.

Remarks

Use this method to allow or prevent overwriting of an existing directory.

This method does not work across disk volumes unless moveOptions contains CopyAllowed.

Whenever possible, avoid using short file names (such as XXXXXX~1.XXX) with this method.

If two directories have equivalent short file names then this method may fail and raise an exception and/or result in undesirable behavior.

Public methodRefresh
Refreshes the state of the object.
(Inherited from FileSystemInfo.)
Public methodRefreshEntryInfo
Refreshes the state of the FileSystemEntryInfo EntryInfo instance.
Public methodSetAccessControl(DirectorySecurity)
Applies access control list (ACL) entries described by a DirectorySecurity object to the directory described by the current DirectoryInfo object.
Public methodSetAccessControl(DirectorySecurity, AccessControlSections)
Applies access control list (ACL) entries described by a DirectorySecurity object to the directory described by the current DirectoryInfo object.
Public methodToString
Returns the original path that was passed by the user.
(Overrides FileSystemInfoToString.)
Top
Fields
  NameDescription
Protected fieldFullPath
Represents the fully qualified path of the file or directory.
(Inherited from FileSystemInfo.)
Protected fieldOriginalPath
The path originally specified by the user, whether relative or absolute.
(Inherited from FileSystemInfo.)
Top
See Also