DirectoryInfoExtensions Class

Contains custom extension methods to use with DirectoryInfo type.

Definition

Namespace: DevCase.Extensions.DirectoryInfoExtensions
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[HideModuleNameAttribute]
public sealed class DirectoryInfoExtensions
Inheritance
Object    DirectoryInfoExtensions

Methods

ContainsFile Determines whether the source directory contains any file with the specified name.
ContainsFiles Determines whether the source directory contains at least one file.
ContainsFolder Determines whether the source directory contains any sub-folder with the specified name.
ContainsFolders Determines whether the source directory contains at least one sub-folder.
CopyTo(DirectoryInfo, DirectoryInfo, Boolean) Coppies the source directory to the specified directory.

If the target directory already exists, an IOException is thrown.

CopyTo(DirectoryInfo, String, Boolean) Coppies the source directory to the specified directory.

If the target directory already exists, an IOException is thrown.

CreateAllDirectories(DirectoryInfo) Creates all directories and subdirectories in the path.
CreateAllDirectories(DirectoryInfo, DirectorySecurity) Creates all directories and subdirectories in the path.
CreateZipFile(DirectoryInfo) Creates a zip archive that contains the files and directories from the specified directory, using the source folder name to create the zip file, with Optimal compression level and UTF8 character encoding for entry name.
CreateZipFile(DirectoryInfo, CompressionLevel) Creates a zip archive that contains the files and directories from the specified directory, using the source folder name to create the zip file, with the specified compression level and UTF8 character encoding for entry name.
CreateZipFile(DirectoryInfo, FileInfo) Creates a zip archive that contains the files and directories from the specified directory, using the specified filepath to create the zip file, with Optimal compression level and UTF8 character encoding for entry name.
CreateZipFile(DirectoryInfo, String) Creates a zip archive that contains the files and directories from the specified directory, using the specified filepath to create the zip file, with Optimal compression level and UTF8 character encoding for entry name.
CreateZipFile(DirectoryInfo, CompressionLevel, Encoding) Creates a zip archive that contains the files and directories from the specified directory, using the source folder name to create the zip file, with the specified compression level and character encoding for entry name.
CreateZipFile(DirectoryInfo, FileInfo, CompressionLevel) Creates a zip archive that contains the files and directories from the specified directory, using the specified filepath to create the zip file, with the specified compression level and UTF8 character encoding for entry name.
CreateZipFile(DirectoryInfo, String, CompressionLevel) Creates a zip archive that contains the files and directories from the specified directory, using the specified filepath to create the zip file, with the specified compression level and UTF8 character encoding for entry name.
CreateZipFile(DirectoryInfo, FileInfo, CompressionLevel, Encoding) Creates a zip archive that contains the files and directories from the specified directory, using the specified filepath to create the zip file, with the specified compression level and character encoding for entry name.
CreateZipFile(DirectoryInfo, String, CompressionLevel, Encoding) Creates a zip archive that contains the files and directories from the specified directory, using the specified filepath to create the zip file, with the specified compression level and character encoding for entry name.
Equals Determines whether the specified object is equal to the current object.
(Inherited from Object)
ExtractIcon Extracts the icon associated for the source directory.
ForceDelete(DirectoryInfo) Forces the deletion of the specified directory if it is empty, by removing the read-only attribute and deleting it.
ForceDelete(DirectoryInfo, Boolean) Forces the deletion of the specified directory, specifying whether to delete subdirectories and files by removing the read-only attribute and deleting them.
GetHashCode Serves as the default hash function.
(Inherited from Object)
GetSize Gets the size of the directory, in bytes.
GetType Gets the Type of the current instance.
(Inherited from Object)
HasParent Determines whether the directory has a parent directory.
HasRights Determines whether the source directory contains the specified user-rights.
IsEmpty Determines whether the source directory is empty (contains no files and no directories).
IsHidden Determines whether the source directory is hidden, i.e., it has the Hidden attribute.
IsReadOnly Determines whether the source directory is read-only, i.e., it has the ReadOnly attribute.
IsRootVolume Determines whether the FullName path in the source directory refers to the root of a volume (e.g "C:\").
IsSystem Determines whether the source directory is a system directory, i.e., it has the System attribute.
MoveTo Moves the source directory to the specified directory.

If the target directory already exists, an IOException is thrown.

OpenInExplorer Opens the source directory in Explorer.
OrderByCreationTime Sorts the elements of the source IEnumerableT by their CreationTime property.
OrderByLastAccessTime Sorts the elements of the source IEnumerableT by their LastAccessTime property.
OrderByLastWriteTime Sorts the elements of the source IEnumerableT by their LastWriteTime property.
OrderByNameAlphabetical Sorts the elements of the source IEnumerableT by their Name property using alphabetical order.

https://en.wikipedia.org/wiki/Alphabetical_order

OrderByNameNatural Sorts the elements of the source IEnumerableT by their Name property using natural order.

https://en.wikipedia.org/wiki/Natural_sort_order

Recycle Sends the source directory to the Recycle Bin.
Rename Renames the name of the directory.
SetRights Sets the user-rights of the source directory.
ToShellItem Converts the source DirectoryInfo to IShellItem.
ToString Returns a string that represents the current object.
(Inherited from Object)

Extension Methods

CanConvertTo Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
CanConvertToT Determines whether the source object can be converted to the specified target type.
(Defined by ObjectExtensions)
ConvertToT Converts an object to the specified target type.

If the conversion fails, an exception is thrown.
(Defined by ObjectExtensions)

ConvertToT Converts an object to the specified target type.

If the conversion fails, returns the specified default value.
(Defined by ObjectExtensions)

IsDisposable Determines whether the specified object is a disposable type (i.e., it implements IDisposable interface).
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
Speak Speaks the string representation of the source object by using the operating system integrated text-to-speech synthesizer.
(Defined by ObjectExtensions)
ThrowIfNullTException Throws the specified exception if the source object is null.
(Defined by ObjectExtensions)

See Also