-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-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
Problem
Possibly a non-issue, but this became apparent when trying to excise a poorly-name directory on Windows ('..
). The folder was non-empty, and could not be entered with PowerShell, CMD, or Explorer to empty.
$files = Get-ChildItem;
$dir = $files[0]; # This is the badly-named directory
Remove-Item -Recursive -Force $dir; # Fails
# I assume because it tries to walk the contents and remove them individually,
# but the oddly-named directory "'.." cannot have its contents enumerated
$dir.Delete($true); # Succeeds, is System.IO.DirectoryInfo.Delete(bool recurse)
Solution
It would possibly speed up and increase the resilience of Remove-Item -Recursive
operations against filesystem providers if PowerShell shortcutted directory removals to call the .NET System.IO.DirectoryInfo.Delete(bool recurse)
method instead of recursively listing-and-deleting contents.
Testing
For testing purposes, the folder '..
was generated in an Angular project with the typo'd command ng generate component "'..\foo"
.
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-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-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.