Microsoft.PowerShell.Archive
Microsoft.PowerShell.Archive copied to clipboard
Instead of throwing "Path too long" error, Expand-Archive throws errors about removing non-existing items
When expanding an archive that contains long file paths to a location that also has a long path, the files to be expanded may have a resulting path that causes an error because it is too long.
When using "Expand All" from within Windows, this results in
Error 0x80010135: Path too long
The same should occur when running Expand-Archive
in PowerShell, but what happens instead is that errors are thrown from Remove-Item
on this line:
https://github.com/PowerShell/Microsoft.PowerShell.Archive/blob/c9fc2b3a303ae6471bf751e6451182fd8835ef40/Microsoft.PowerShell.Archive/Microsoft.PowerShell.Archive.psm1#L408
Remove-Item : Cannot find path {...} because it does not exist.
It appears that this line of code is meant to clean up after a failed expansion, but it is trying to remove items that it hasn't expanded yet, so this would indicate another issue.
I am experiencing the same problem exactly; it is amazing that these windows 95 era path limitation problems are still around 20+ years later.
FYI: There is a workaround for this issue: instead of using Expand-Archive
, use 7-zip.
Following this suggestion worked in our environment: https://stackoverflow.com/a/58289112/1009693
Name Value
---- -----
PSVersion 5.1.14393.3866
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3866
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
We will reopen this issue if it is still persistent.
This issue still occurs
Jep Chap can confirm. Still exists. Whats the reason behind .zip?
@ayousuf23 please reopen
@SydneyhSmith please reopen
Ongoing issue for me please resolve