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
Exibir arquivo Open project: jornfilho/.net-Dev-Utils Class Usage Examples

Public Methods

Method 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 method

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.
return bool

CreateDirectory() public method

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

DeleteDirectory() public method

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.
return bool

DeleteDirectoryContents() public method

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

DirectoryExists() public method

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

GetCountOfSubdirectories() public method

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

GetDirectoryPermission() public method

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

GetParentDirectory() public method

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

IsDirectory() public method

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.
return bool

SetDirectoryPermission() public method

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.
return bool

SetDirectoryPermissions() public method

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.
return bool