20 lines
796 B
PowerShell
20 lines
796 B
PowerShell
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||
|
|
$zip = [System.IO.Compression.ZipFile]::OpenRead('d:\20_AI\LSPi\tools\rtthread-nano.zip')
|
||
|
|
$dest = 'd:\20_AI\LSPi\libs\thirdparty\rt-thread'
|
||
|
|
$prefix = 'rtthread-nano-master/rt-thread/'
|
||
|
|
$count = 0
|
||
|
|
foreach ($e in $zip.Entries) {
|
||
|
|
if ($e.FullName.StartsWith($prefix) -and !$e.FullName.EndsWith('/')) {
|
||
|
|
$rel = $e.FullName.Substring($prefix.Length)
|
||
|
|
$out = Join-Path -Path $dest -ChildPath $rel
|
||
|
|
$dir = [System.IO.Path]::GetDirectoryName($out)
|
||
|
|
if (!(Test-Path $dir)) {
|
||
|
|
New-Item -ItemType Directory -Path $dir -Force > $null
|
||
|
|
}
|
||
|
|
[System.IO.Compression.ZipFileExtensions]::ExtractToFile($e, $out, $true)
|
||
|
|
$count++
|
||
|
|
}
|
||
|
|
}
|
||
|
|
$zip.Dispose()
|
||
|
|
Write-Host "Extracted $count files to $dest"
|