Here is one way to get you started, using .Net Framework 4.5's ZipFile and ZipFileExtensions classes:
Add-Type -Assembly System.IO.Compression.FileSystem
foreach($sourcefile in (Get-ChildItem -filter "*.zip"))
{
Write-Host "Processing $sourcefile"
$entries = [IO.Compression.ZipFile]::OpenRead($sourcefile.FullName).Entries
#first pass to collect the paths of the folders with a Style.CSS file
$folders = $entries |
?{ $_.Name -eq 'Style.CSS' } |
%{ split-path $_.FullName } | unique
#second pass to extract just the files in those folders
$entries |
?{ (split-path $_.FullName) -in @($folders) -and $_.Name } |
%{
#compose some target path
$targetpath = join-path "$targetroot" (join-path $sourcefile.Name $_.FullName)
#create its directory
md (split-path $targetfilename) >$null 2>&1
#extract the file (and overwrite)
[IO.Compression.ZipFileExtensions]::ExtractToFile($_, $targetfilename, $true)
}
}
Just define some targetroot
or compose another targetpath
…