FileHandling/New-EmptyDirectory.ps1
<# .Synopsis Creates a new folder .Description Creates a new folder. If the folder exists, the contents will be deleted .Parameter DirectoryPath Path to the folder to be created .Example New-EmmptyDirectory -DirectoryPath "C:\Temp" #> Function New-EmptyDirectory { [CmdletBinding(SupportsShouldProcess, ConfirmImpact="low")] Param( [Parameter(Mandatory=$true)] [string]$DirectoryPath ) if ($PSCmdlet.ShouldProcess("$DirectoryPath", "This new folder will be created ")) { if([IO.Directory]::Exists($DirectoryPath)) { Remove-Item $DirectoryPath -Recurse -Force } [IO.Directory]::CreateDirectory($DirectoryPath) | Out-Null } } |