Powershell unzip zip file having large number of files -
i'm trying unzip zipped file. i've written code follows
function unzip($sourcezip, $destination) { $shell = new-object -com shell.application $zip = $shell.namespace($sourcezip) $dest = $shell.namespace($destination) foreach($item in $zip.items()) { $dest.copyhere($item, 0x14) } }
i'm calling script on input zip file contain around 14k files below
unzip "source.zip" "destination"
this file gets stuck more 30 minutes. , still no progress.
from i've find out gets @ line $zip.items()
might taking large time discover files.
is there better, optimal way this??
thanks in advance. regards, ganesh.
you using system.io.compression (requires .net 4.5):
[system.reflection.assembly]::loadwithpartialname('system.io.compression.filesystem') [system.io.compression.zipfile]::extracttodirectory($sourcezip, $destination)
Comments
Post a Comment