-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Remove-Item -Recurse on symlink should recurse when path ends with path separator #3674
Copy link
Copy link
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-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.
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-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.
Part of the resolution of issue #621 was to have the
-Recurseoption be ignored when removing a symlink to a directory with a command such asRemove-Item -Recurse -Path linktodir, to be more in line with the unix Unixrmcommand.However, on Unix the
rmcommand, when given asrm -r linktodir/', with the trailing slash on the pathname, *will* recurse into the target directory and delete its contents, then remove the link, leaving the target directory behind. Without the trailing slashrm -r linktodir` simply removes the link.Steps to reproduce
Expected behavior
Symbolic link
link-to-subshould be deleted, directorysubdirshould still exist but be empty.Actual behavior
On Linux, the directory
subdiris emptied and remains, but an error is emitted and the symbolic link is not deleted. Error isNot a directory.On Windows, the symbolic link is deleted but the directory
subdirand its contents remain.Environment data