function Get-ConfigurationFiles { <# .SYNOPSIS Pulls an Array of Configuration Files Which Need Updates .PARAMETER stagedFilePath The base path to search for config files in, such as C:\ORB or C:\Temp\Deploy\ORB .PARAMETER findTempFiles Defaults to $false. If set to $true, looks for new.*.config instead of *.config. Used when looking for the temporary config files which come out of the build process #> [CmdletBinding()] param( [Parameter(Mandatory=$true)] [string]$stagedFilePath, [Parameter(Mandatory=$false)] [bool]$findTempFiles = $false ) $logLead = (Get-LogLeadName); Write-Host ("$logLead : Finding Configuration Files in Non-Symlink Folders Under {0}" -f $stagedFilePath) $tempOrbfolders = Get-ChildItem -Directory $stagedFilePath | ` Where-Object { $_.Attributes -notmatch "ReparsePoint" -and $_.Name -ne "Shared" } | ` Select-Object -ExpandProperty FullName # Get-ChildItem is a bit finicky. We're going to trim \ from the end, then add \*, to use Include/Exclude without recursion $tempOrbFolders = $tempOrbFolders | ForEach-Object { $_.TrimEnd("\") | ForEach-Object {$_ + "\*"}} if ($findTempFiles) { $configfiles = Get-ChildItem $tempOrbfolders -Include "new.*.config" -Exclude "new.log4net.config" | Select-Object -ExpandProperty FullName } else { $configfiles = Get-ChildItem $tempOrbfolders -Include "*.config" -Exclude "log4net.config","new*.config" | Select-Object -ExpandProperty FullName } Write-Verbose ("$logLead : Found {0} Configuration Files" -f $configFiles.Count) return $configFiles }