Create directory if it doesn't exist

function CreateDirIfItDoesNotExist
{
param([string]$folder)
	"Entering Powershell Library: CreateDirIfItDoesNotExist: Test for existence of " + $folder | Write-host
	if (Test-Path $folder)
	{
		$folder + " already exists, not disturbing it!" | Write-host
	}
	{
		$folder + " does not exist, creating it" | Write-host
		New-Item $folder -type directory -Force 
	}
}
Sign In or Register to comment.