指定したフォルダ配下の log を zip で固める
$7z = 'C:\Program Files\7-Zip\7z.exe' $dir = 'f:\Exchange\LogFiles' Get-ChildItem $dir -Recurse | foreach { if ($_.Name -match '.+log$') { $orig = $_.FullName $zip = $_.FullName + '.zip' & $7z a -tzip $zip $orig rm $orig } }