Last active
March 28, 2022 15:10
-
-
Save bsara/1405dd9b1d8f08d78beb to your computer and use it in GitHub Desktop.
PowerShell: Function that creates a directory if it doesn't exist, does NOT throw an error if directory already exists
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 Create-Directory($dirPath) { | |
if (!(Test-Path $dirPath)) { | |
New-Item -ItemType directory -Path $dirPath | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment