Skip to content

Instantly share code, notes, and snippets.

@fslef
Last active June 26, 2023 13:37
Show Gist options
  • Save fslef/00e6f0bb9a5d3b9401c8682da7e72b34 to your computer and use it in GitHub Desktop.
Save fslef/00e6f0bb9a5d3b9401c8682da7e72b34 to your computer and use it in GitHub Desktop.
New-Folder
function New-Folder {
param (
[Parameter(Position = 0, Mandatory = $true)]
[string]
$Path
)
if (Get-Item $path -ErrorAction Ignore) {
Write-Verbose "Folder $path already exists."
}
else {
New-Item -Path $path -ItemType Directory | Out-Null
Write-Verbose "Folder $path created successfully."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment