public/New-FootballFixtureFolder.ps1
function New-FootballFixtureFolder { [CmdletBinding()] param( [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Competition, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Date, [Parameter(Mandatory=$true)] [ValidateNotNullOrEmpty()] [string]$Path ) process{ $ErrorActionPreference = 'Stop' try { $FixtureFolderNames = Get-FootballFixtureFolderName -Competition $Competition -Date $Date -Path $Path foreach ($FixtureFolderName in $FixtureFolderNames) { $FixtureFolders =@('multi-media','pre-match-news','post-match-news','working-set') foreach ($FixtureFolder in $FixtureFolders) { $FullPath = "$Path\fixture-artifact\$FixtureFolder\$Competition\$Date\$FixtureFolderName" $PathExists = Test-Path -Path $FullPath if (!$PathExists) { New-Item -Path $FullPath -ItemType Directory -Verbose | Out-Null } else { Write-Warning "$FullPath already exists." } # if } # foreach } # foreach } catch { "$($MyInvocation.MyCommand.Name): $_.Exception.Message" } # trycatch } # process } # function |