< Back

Uninstall-CDirectory

Sun Jan 12, 2020 11:38 pm

NAME Uninstall-CDirectory



SYNOPSIS

Removes a directory, if it exists.





SYNTAX

Uninstall-CDirectory [-Path] <String> [-Recurse] [<CommonParameters>]





DESCRIPTION

The `Uninstall-CDirectory` function removes a directory. If the directory doesn't exist, it does nothing. If the

directory has any files or sub-directories, you will be prompted to confirm the deletion of the directory and all

its contents. To avoid the prompt, use the `-Recurse` switch.



`Uninstall-CDirectory` was added in Carbon 2.1.0.





PARAMETERS

-Path <String>

The path to the directory to create.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Recurse [<SwitchParameter>]

Delete the directory *and* everything under it.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Uninstall-CDirectory -Path 'C:\\Projects\\Carbon'



Demonstrates how to remove/delete a directory. In this case, the directory `C:\\Projects\\Carbon` will be deleted,

if it exists.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Uninstall-CDirectory -Path 'C:\\Projects\\Carbon' -Recurse



Demonstrates how to remove/delete a directory that has items in it. In this case, the directory

`C:\\Projects\\Carbon` *and all of its files and sub-directories* will be deleted, if the directory exists.











RELATED LINKS