-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module
Description
Good evening
of course, anno 2017 it's annoying to still have to fight with 260 character limits and that powershell is not using the unicode File API. (Win10 LongPathsEnabled is set to 1). Anyway.
Remove-Item cannot delete a directory which was created by Net-Item, it reports that the path is "too long".
Steps to reproduce
PS C:\temp> # Create a Directory
PS C:\temp> $dirname = 'c:\Temp\123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345'
PS C:\temp> New-Item -ItemType Directory -Force -Path $dirname
Directory: C:\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 25.05.2017 00:52 123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345
PS C:\temp> # Delete Directory
PS C:\temp> Remove-Item -Force -Recurse -Path $dirname
Remove-Item : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
At line:1 char:1
+ Remove-Item -Force -Recurse -Path $dirname
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (C:\Temp\1234567...123456789012345:String) [Remove-Item], PathTooLongException
+ FullyQualifiedErrorId : RemoveItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommandExpected behavior
We expect, that PowerShell suports some 1000s characters.
But at least, that Remove-Item can delete Items which were created by New-Item.
Actual behavior
Remove-Item can not delete Items with long path names which were created by New-Item.
Environment data
> $PSVersionTable
PS C:\temp> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.14393.693
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.693
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Metadata
Metadata
Assignees
Labels
Issue-Discussionthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifthe issue may not have a clear classification yet. The issue may generate an RFC or may be reclassifResolution-AnsweredThe question is answered.The question is answered.WG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management module