To select every AssemblyInfo.cs from a directory minus specifically one, I run a powershell script :
Clear-Host
$SrcDir = "D:\Projects\Lambda\Sources"
Write-Host $SrcDir
cd $SrcDir
$ExcludeXYZCallStrategy = $SrcDir + "\Lambda.XYZ\XYZCallStrategy\Properties\AssemblyInfo.cs"
# 2. Select Files to be updated
Write-Host $ExcludeXYZCallStrategy
# both these syntaxes fail (tried one after the other not together ofc) :
$Assemblyfiles = Get-ChildItem -Path $SrcDir -Recurse -Include AssemblyInfo.cs -Exclude $ExcludeXYZCallStrategy
$Assemblyfiles = Get-ChildItem -Path $SrcDir -Recurse -Include AssemblyInfo.cs -Exclude D:\Projects\Lambda\Sources\Lambda.XYZ\XYZCallStrategy\Properties\AssemblyInfo.cs
Write-Host $Assemblyfiles
Write-Host "Files Count : " $Assemblyfiles.count
I tried different syntaxes to force Get-ChildItem to exclude that one file but I failed.
I tried these these answers to no avail :
- How to use Get-ChildItem with excluding a list of items with an array in Powershell?
- Get-ChildItem Exclude and File parameters don't work together
From the doc, I found nothing that would explain why the file is not excluded.