C# Class DevUtils.Io.IoDirectoryUtils

The IoDirectoryUtils type provides an implementation of the IIoDirectoryUtils interface that provides utility methods for common I/O directory operations.

Base project reference: https://github.com/cjaehnen/OpenLib.Utils

Inheritance: IIoDirectoryUtils
Afficher le fichier Open project: jornfilho/.net-Dev-Utils Class Usage Examples

Méthodes publiques

Méthode Description
CopyDirectory ( string sourcePath, string targetPath ) : bool

Copies the specified source directory to the target path.

CreateDirectory ( string path ) : bool

Creates the specified directory if it does not exist.

DeleteDirectory ( string path ) : bool

Deletes the specified directory if it exists.

Recursively deletes all sub directories and files in the specified directory.

DeleteDirectoryContents ( string path ) : bool

Deletes all files and subdirectories in the specified directory.

DirectoryExists ( string path ) : bool

Gets a value indicating if the specified directory exists.

GetCountOfSubdirectories ( string path ) : int

Gets a count indicating the number of subtirectories in the specified directory.

GetDirectoryPermission ( string path ) : IList

Gets a directory permissions list

GetParentDirectory ( string path ) : DirectoryInfo

Get parent directory if exists

IsDirectory ( string path ) : bool

Gets a value indicating if the specified path is a directory.

SetDirectoryPermission ( string path, FileSystemRights permission ) : bool

Set a directory permission

SetDirectoryPermissions ( string path, FileSystemRights permissions ) : bool

Set a directory permission list

Method Details

CopyDirectory() public méthode

Copies the specified source directory to the target path.
public CopyDirectory ( string sourcePath, string targetPath ) : bool
sourcePath string The path to the source directory.
targetPath string The path to the target directory.
Résultat bool

CreateDirectory() public méthode

Creates the specified directory if it does not exist.
public CreateDirectory ( string path ) : bool
path string The path to the directory to create.
Résultat bool

DeleteDirectory() public méthode

Deletes the specified directory if it exists.
Recursively deletes all sub directories and files in the specified directory.
public DeleteDirectory ( string path ) : bool
path string The path to the directory to delete.
Résultat bool

DeleteDirectoryContents() public méthode

Deletes all files and subdirectories in the specified directory.
public DeleteDirectoryContents ( string path ) : bool
path string The path to the directory.
Résultat bool

DirectoryExists() public méthode

Gets a value indicating if the specified directory exists.
public DirectoryExists ( string path ) : bool
path string The path to the directory.
Résultat bool

GetCountOfSubdirectories() public méthode

Gets a count indicating the number of subtirectories in the specified directory.
public GetCountOfSubdirectories ( string path ) : int
path string The path to the directory.
Résultat int

GetDirectoryPermission() public méthode

Gets a directory permissions list
public GetDirectoryPermission ( string path ) : IList
path string The path to the directory.
Résultat IList

GetParentDirectory() public méthode

Get parent directory if exists
public GetParentDirectory ( string path ) : DirectoryInfo
path string Directory path.
Résultat System.IO.DirectoryInfo

IsDirectory() public méthode

Gets a value indicating if the specified path is a directory.
public IsDirectory ( string path ) : bool
path string The path to validate as a directory.
Résultat bool

SetDirectoryPermission() public méthode

Set a directory permission
public SetDirectoryPermission ( string path, FileSystemRights permission ) : bool
path string The path to the directory.
permission FileSystemRights Permission to set on directory.
Résultat bool

SetDirectoryPermissions() public méthode

Set a directory permission list
public SetDirectoryPermissions ( string path, FileSystemRights permissions ) : bool
path string The path to the directory.
permissions FileSystemRights Permissions to set on directory.
Résultat bool