diff --git a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 index 9112367..1421444 100644 --- a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 +++ b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/09-Setup-WaxAndTrace.ps1 @@ -195,7 +195,15 @@ if (-not $asset) { $hasBrokenFilenames = $false if (Test-Path -LiteralPath $srcDataDir) { - $hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -Filter '*[0-9] _*.txt' -ErrorAction SilentlyContinue | Select-Object -First 1) + # Get-ChildItem -Filter uses Win32 filtering and does NOT + # honor PowerShell wildcards / character classes - '[0-9]' + # would match literal bracketed text. Use -Include + + # Where-Object regex instead. The bug signature is + # ' _' (space-underscore) inside the filename, e.g. + # 'Linear_X_218-378-13 _100072210.txt'. + $hasBrokenFilenames = [bool](Get-ChildItem -LiteralPath $srcDataDir -File -ErrorAction SilentlyContinue | + Where-Object { $_.Name -match ' _\d+\.txt$' } | + Select-Object -First 1) } if ($hasBrokenFilenames) {