Skip to content

Native globbing on Unix lacks ability to include hidden items #4683

Closed

Description

Get-Item and Get-ChildItem have the -Force switch for including hidden items in the enumeration / matching of item names.

Currently, there is no analog when calling an external utility with a glob (wildcard pattern) argument.

Unfortunately, it looks like the only way to provide this ability would be via a new preference variable.

In bash, it is shell option dotglob that controls whether hidden items are included or not.

Current behavior

# Create temp. dir. for easy experimentation.
Push-Location (New-Item -Force -ItemType Directory -Path ($tmpDir = [io.Path]::GetTempPath() + "globtest.$PID"))
# Create a regular and a hidden file.
$null = New-Item -Force -Path 'a', '.a' -ItemType File


# This currently returns only 'a', 
# with no way to opt into returning the hidden '.a' file too.
' --- printf *'
printf '%s\n' *

# With Get-Item/Get-ChildItem, using -Force opts into including hidden items.
' --- Get-Item -Force *'
Get-Item -Force * | % Name

# Remove temp. dir.
Pop-Location
Remove-Item -Force -Recurse $tmpDir

Environment data

PowerShell Core v6.0.0-beta.6 on macOS 10.12.6
PowerShell Core v6.0.0-beta.6 on Ubuntu 16.04.3 LTS

Activity

  1. added
    WG-Languageparser, language semantics
    Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassif
    on Aug 28, 2017
  2. added
    WG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
    and removed
    WG-Languageparser, language semantics
    on Jul 12, 2019
  3. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  4. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  5. microsoft-github-policy-service commented on Nov 16, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has not had any activity in 6 months, if this is a bug please try to reproduce on the latest version of PowerShell and reopen a new issue and reference this issue if this is still a blocker for you.

  6. microsoft-github-policy-service commented on Nov 23, 2023

    @microsoft-github-policy-service
    Contributor

    This issue has been marked as "No Activity" as there has been no activity for 6 months. It has been closed for housekeeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-FileSystem-Providerspecific to the FileSystem providerIssue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-No ActivityIssue has had no activity for 6 months or moreWG-Cmdletsgeneral cmdlet issuesWG-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