Public/Test-PathExists.ps1

function global:Test-PathExists
{
        <#
            .EXTERNALHELP HelperFunctions.psm1-Help.xml
        #>

    
    [CmdletBinding()]
    param
    (
        [Parameter(Mandatory = $true,
                 Position = 0)]
        [String]$Path,
        [Parameter(Mandatory = $true,
                 Position = 1)]
        [Object]$PathType
    )
    
    Begin { $VerbosePreference = 'Continue' }
    
    Process
    {
        Switch ($PathType)
        {
            File
            {
                If ((Test-Path -Path $Path -PathType Leaf) -eq $true)
                {
                    Write-Information -MessageData "File: $Path already exists..."
                }
                Else
                {
                    New-Item -Path $Path -ItemType File -Force
                    Write-Verbose -Message "File: $Path not present, creating new file..."
                }
            }
            Folder
            {
                If ((Test-Path -Path $Path -PathType Container) -eq $true)
                {
                    Write-Information -MessageData "Folder: $Path already exists..."
                }
                Else
                {
                    New-Item -Path $Path -ItemType Directory -Force
                    Write-Verbose -Message "Folder: $Path not present, creating new folder"
                }
            }
        }
    }
    
    End { }
    
}#end function Test-PathExists