$files = Get-ChildItem -Recurse -Filter *.java -Path 'crm-customer\src', 'crm-auth\src' | Where-Object { $_.Name -match 'CustomerDedupService|ApiPermissionInterceptor' } foreach ($f in $files) { $b = [IO.File]::ReadAllBytes($f.FullName) $bom = ($b.Length -ge 3 -and $b[0] -eq 0xEF -and $b[1] -eq 0xBB -and $b[2] -eq 0xBF) Write-Output ($f.FullName + ' BOM=' + $bom) }