Directory Operations

Summary

Contains extension methods for working with directories.

General

Directory(ICakeContext, string) Gets a directory path from string.

Clean

CleanDirectories(ICakeContext, IEnumerable<DirectoryPath>) Cleans the specified directories. Cleaning a directory will remove all its content but not the directory itself.
CleanDirectories(ICakeContext, IEnumerable<string>) Cleans the specified directories. Cleaning a directory will remove all its content but not the directory itself.
CleanDirectories(ICakeContext, string) Cleans the directories matching the specified pattern. Cleaning the directory will remove all its content but not the directory itself.
CleanDirectories(ICakeContext, string, Func<IFileSystemInfo, bool>) Cleans the directories matching the specified pattern. Cleaning the directory will remove all its content but not the directory itself.
CleanDirectory(ICakeContext, DirectoryPath) Cleans the specified directory.
CleanDirectory(ICakeContext, DirectoryPath, Func<IFileSystemInfo, bool>) Cleans the specified directory.

Copy

CopyDirectory(ICakeContext, DirectoryPath, DirectoryPath) Copies the contents of a directory, including subdirectories to the specified location.
TransferDirectory(ICakeContext, DirectoryPath, DirectoryPath) Obsolete: Use Cake.Common.IO.CopyDirectory instead
Addin from Cake.Incubator.dll

Create

CreateDirectory(ICakeContext, DirectoryPath) Creates the specified directory.

Delete

Exists

DirectoryExists(ICakeContext, DirectoryPath) Determines whether the given path refers to an existing directory.
EnsureDirectoryExists(ICakeContext, DirectoryPath) Creates the specified directory if it does not exist.

List

GetSubDirectories(ICakeContext, DirectoryPath) Gets a list of all the directories inside a directory.

Move

MoveDirectory(ICakeContext, DirectoryPath, DirectoryPath) Moves an existing directory to a new location, providing the option to specify a new directory name.

Path

MakeAbsolute(ICakeContext, DirectoryPath) Makes the path absolute (if relative) using the current working directory.