Please feel free to provide feedback or file bugs here.

Bug: -Exclude does not work as -Include does in Get-ChildItem, or as expected

Three folders; d1, d2, d3, with files test.txt and test.mp3 in in d1 and d3.

'-Include *d1*' includes only content from d1. Would expect '-Exclude *d1*' to include the inverse, but it has no effect, it returns all data.

unless it's run after -Include.

So '-Include *d1* -Exclude *d1*' returns nothing, as expected.

Exclude only works as it applies to a file name, not a path.

So '-Exclude *.txt' will exclude all files '*.txt' as expected.

The syntax usage in the help file is identical for both parameters.

Please fix -Exclude parameter so that it works on the Path consistently, as the documentation states it should.

2 votes
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Tucker Goodrich shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    0 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base