powershell

Powershell Scripting - Building Blocks

By Ganessh Kumar1 min read
  • powershell
  • scripting

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
}

Keep reading

I write about full-stack development, developer tooling and the problems I run into building things. Here is everything else on the blog.