public/Get-FootballFixtureFolderName.ps1

function Get-FootballFixtureFolderName {

    [CmdletBinding()]
    param(

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Competition,

        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Date,
        
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [string]$Path

    )
    process{

        $ErrorActionPreference = 'Stop'

        try {

            $PredictionsSourcePath = "$Path\sportsmonk-predictions\$Competition\$Date\$Competition-231-$Date.csv"
            $PredictionsSourcePathExists = Test-Path -Path $PredictionsSourcePath

            if ($PredictionsSourcePathExists) {

                $Fixtures = Import-Csv -Path $PredictionsSourcePath

                foreach ($Fixture in $Fixtures) {

                    $NewFixtureName = ($Fixture.FixtureName).Replace(' ','-')
                    $FolderName = "$($Fixture.FixtureId)-$NewFixtureName"
                    $FolderName 
        
                } # foreach

            }
            else {

                Write-Warning -Message "Prediction File does not exist: $PredictionsSourcePath."

            } # if

        }
        catch {

           "$($MyInvocation.MyCommand.Name): $_.Exception.Message"
            
        } # try catch

    } # process

} # function