Powershell Scripting - Building Blocks

December 10, 2018

Check and create directory if it doesn't exist

$SourceDir = "directoryName"
if (!(Test-Path -Path $SourceDir ))
{
    Write-Host "Creating {$SourceDir} directory" -ForegroundColor Green
    New-Item -ItemType directory -Path $SourceDir
}
Ganessh Kumar R P © 2020 • All rights reserved.