RemoveDir

Summary

Deletes the contents of one or more directories.

RemoveDir( 'name' ) // Name (required) { // Basic options .RemovePaths // Directories to delete contents of .RemovePathsRecurse // (optional) Recurse into sub-directories? (default: true) // Filtering options .RemovePatterns // (optional) Wildcards of contents to delete (default: *) .RemoveExcludePaths // (optional) Directories to ignore if recursing // Additional options .PreBuildDependencies // (optional) Force targets to be built before this RemoveDir }
Details

RemoveDir() can be used to delete the contents of a directory. By default, the sub-driectories are recursed and all files are deleted. Recursion can be disabled (.PathsRecurse), individual sub-directories can be ignored (.ExcludePaths) and files to be deleted can be filtered (.PathsPattern).

Basic Options

.RemovePaths - String/ArrayOfStrings - (Required)

One or more paths can be provided, either as a string or an array of strings. Each path will be traversed and files within it deleted (subject to other settings).

Example:
.RemovePaths = 'folder\'
Or:
.RemovePaths = { 'folderA\', 'folderB\' }


.RemovePathsRecurse - Bool - (Optional)

Directories are scanned recursively by default. Recursion can be disabled.

Example:
.RemovePathsRecurse = false
Filtering Options
.RemovePatterns - String/ArrayOfStrings - (Optional)

All discovered files will be deleted by default. Deletion can be restricted to certain files or sub-directories by specifying .RemovePatterns wildcards.

Example:
.RemovePatterns = '*.obj' // Delete all *.obj files
Example:
.RemovePatterns = { 'subdir/*.exe', // Delete *.exe files in "subdir" 'subdir/*.pdb' } // Delete *.pdb files in "subdir"


.RemoveExcludePaths - String/ArrayOfStrings - (Optional)

Specific sub-directories can be ignored during recursion.

Example:
.RemoveExcludePaths = 'folderA/' // Ignore contents of folder
Example:
.RemoveExcludePaths = { 'folderA/', // Ignore contents of "folderA" 'FolderB/' } // and "folderB"
Other Options

.PreBuildDependencies - String/ArrayOfStrings - (Optional)

One or more nodes which must be built before this node is built.

The .PreBuildDependencies option ensures the specified targets are up-to-date before the RemoveDir() is executed.

Example:
.PreBuildDependencies = 'DoStuff' // A previously defined target