Skip to content

PS Get-ChildItem -Exclude still not working as described #15270

@AlfiCode

Description

@AlfiCode

Steps to reproduce

[System.IO.FileInfo[]]$Files=Get-ChildItem -Path $RootDir -Include  "packages.config" -Exclude "out" -Recurse -Force

Search for specific files and exclude one directory eg. -Exclude "out".
A file with the name in -Include "packages.config" is also listed even from dir "out"

Expected behavior

The file under "out"-out shall not be listed


## Actual behavior
The file under "out"-dir is listed

Environment data

Name Value


PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions