internal/Get-Files.ps1

<#
.SYNOPSIS
provides and array of file paths from a destination and filter
 
.DESCRIPTION
provides and array of filepaths from a destination and filter
 
.PARAMETER TargetFolder
location to check
 
.PARAMETER fileFilter
filter to apply of location
 
.EXAMPLE
Get-Files -TargetFolder "C:\Temp" -fileFilter "*.*"
Get-Files -TargetFolder "C:\Temp" -fileFilter "*.config"
Get-Files -TargetFolder "C:\Temp" -fileFilter "*.txt, *.config"
 
.NOTES
General notes
#>

function Get-Files {
    [CmdletBinding()]
    param(
        [parameter(Mandatory = $true)]
        [string]
        $TargetFolder, 
        [parameter(Mandatory = $true)]
        [string]
        $fileFilter
    )
    begin {
    }
    process {
        $files = (Get-ChildItem -Path $TargetFolder -File -Filter $fileFilter -Recurse | Select-Object -ExpandProperty FullName)
        if (!$files) {
            Write-Error "ERROR: No files found in $destinationFolder with $fileFilter filter"
        }
    }
    end {
        $files
    }
}