Last active
June 26, 2023 13:37
-
-
Save fslef/00e6f0bb9a5d3b9401c8682da7e72b34 to your computer and use it in GitHub Desktop.
New-Folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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