Microsoft.PowerShell.Archive icon indicating copy to clipboard operation
Microsoft.PowerShell.Archive copied to clipboard

Instead of throwing "Path too long" error, Expand-Archive throws errors about removing non-existing items

Open NReilingh opened this issue 5 years ago • 8 comments

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.

NReilingh avatar Mar 01 '19 23:03 NReilingh

I am experiencing the same problem exactly; it is amazing that these windows 95 era path limitation problems are still around 20+ years later.

NicolasRouquette avatar Mar 18 '21 23:03 NicolasRouquette

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   

NicolasRouquette avatar Mar 19 '21 16:03 NicolasRouquette

We will reopen this issue if it is still persistent.

ayousuf23 avatar Aug 17 '22 21:08 ayousuf23

This issue still occurs

paololazzari avatar Dec 09 '22 13:12 paololazzari

Jep Chap can confirm. Still exists. Whats the reason behind .zip? image

BenjaminNiemann avatar Aug 11 '23 07:08 BenjaminNiemann

@ayousuf23 please reopen

paololazzari avatar Aug 11 '23 07:08 paololazzari

@SydneyhSmith please reopen

paololazzari avatar Aug 11 '23 09:08 paololazzari

Ongoing issue for me please resolve

Deondrede avatar Aug 29 '23 21:08 Deondrede