Share via


Specified Path,, file name, or both are too long to extract the zip file contents through Powershell script

Question

Friday, July 14, 2017 5:49 AM

Hi

    Iam getting the below error where am trying to extract the zip file contents through Powershell script, I have n-level of folders inside that i have a zip file in each folder which i need to copy and extract through powershell script in each folder and place that in the same folder and i have to maintain the same tree structure i cannot trim or alter the path or alter the filename or folder names and contents in side it.

Exception calling "ExtractToDirectory" with "2" argument(s): "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 Z:\Desktop\myscript.ps1:92 char:5

+     [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile,$out ...

+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : PathTooLongException

All replies (2)

Friday, July 14, 2017 7:29 AM

Your file path has exceeded the Windows limit.  You have to shorten the path.

https://www.howtogeek.com/266621/how-to-make-windows-10-accept-file-paths-over-260-characters/

\(ツ)_/


Saturday, August 5, 2017 3:41 AM

I am suggesting to try "Long Path Tool" program.