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-Language
    Issue-Discussion
    on Aug 28, 2017
  2. added
    WG-Engine-Providers
    and removed
    WG-Language
    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. added
    Resolution-No Activity
    on Nov 16, 2023
  6. 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.

  7. 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-ProviderIssue-DiscussionResolution-No ActivityWG-CmdletsWG-Engine-Providers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions