-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Get-ChildItem -Exclude/-Include #16751
Copy link
Copy link
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-DuplicateThe issue is a duplicate.The issue is a duplicate.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
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 DOActual behavior
NOTHING TO DOError details
NOTHING TO DOEnvironment 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.1Visuals
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerNeeds-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-DuplicateThe issue is a duplicate.The issue is a duplicate.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.