Skip to content

Get-ChildItem -Exclude/-Include #16751

@20-EverGreen-2

Description

@20-EverGreen-2

Prerequisites

Steps to reproduce

PS G:\> Get-ChildItem -LiteralPath "G:\" -Hidden

OR

PS G:\> Get-ChildItem -Path "G:\*" -Hidden


    Directorio: G:\


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-rhs-        08/12/2021      7:28                boot
d-rhs-        08/12/2021      7:28                EFI
d-rhs-        27/09/2020     23:36                GRUB
d-rhs-        26/11/2015      3:25                I386
d-rhs-        14/01/2022     11:28                IMG
d--hs-        01/12/2010      8:23                System Volume Information
-a-hs-        31/03/2020     14:16             48 BOOTDISK.KEY
-arhs-        30/10/2015     16:19         400228 bootmgr
-arhs-        30/10/2015     16:19        1147736 bootmgr.efi
-arhs-        31/03/2009     22:20         217769 grldr
-arhs-        31/03/2009     22:20           9216 grldr.mbr
-a-hs-        31/03/2020     14:16            164 _bootDisk.ini

THE ABOVE CODE IS OK.

NEXT CODE RETURNS BAD DATA:

PS G:\> Get-ChildItem -Path "G:\*" -Exclude "System Volume Information" -Hidden


    Directorio: G:\boot


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a-hs-        03/04/2020     12:09          65536 bcd.LOG
-a-hs-        04/08/2016     21:15              0 bcd.LOG1
-a-hs-        04/08/2016     21:15              0 bcd.LOG2


    Directorio: G:\


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a-hs-        31/03/2020     14:16             48 BOOTDISK.KEY
-arhs-        30/10/2015     16:19         400228 bootmgr
-arhs-        30/10/2015     16:19        1147736 bootmgr.efi
-arhs-        31/03/2009     22:20         217769 grldr
-arhs-        31/03/2009     22:20           9216 grldr.mbr
-a-hs-        31/03/2020     14:16            164 _bootDisk.ini

THE CODE ABOVE HIDE SOME DIRECTORIES.

NEXT ANOTHER VARIANT:

PS G:\> Get-ChildItem -LiteralPath "G:\" -Exclude "System Volume Information" -Hidden


    Directorio: G:\


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-rhs-        08/12/2021      7:28                boot
d-rhs-        08/12/2021      7:28                EFI
d-rhs-        27/09/2020     23:36                GRUB
d-rhs-        26/11/2015      3:25                I386
d-rhs-        14/01/2022     11:28                IMG
d--hs-        01/12/2010      8:23                System Volume Information
-a-hs-        31/03/2020     14:16             48 BOOTDISK.KEY
-arhs-        30/10/2015     16:19         400228 bootmgr
-arhs-        30/10/2015     16:19        1147736 bootmgr.efi
-arhs-        31/03/2009     22:20         217769 grldr
-arhs-        31/03/2009     22:20           9216 grldr.mbr
-a-hs-        31/03/2020     14:16            164 _bootDisk.ini

THE CODE ABOVE DOESNT HIDE "System Volume Information"

Expected behavior

NOTHING TO DO

Actual behavior

NOTHING TO DO

Error details

NOTHING TO DO

Environment data

PS C:\Windows\system32> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1320
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1320
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FileSystem-Providerspecific to the FileSystem providerNeeds-TriageThe issue is new and needs to be triaged by a work group.Resolution-DuplicateThe issue is a duplicate.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions