John Siu Blog

Tech - Business Tool, Personal Toys

Shell - PowerShell

☰ Table of Content

PowerShell cheat sheet.

Zip Files Individually

Zip all log files (*.log) in folder:

1
2
3
4
5
6
Get-ChildItem -Path . -Filter *.log | ForEach-Object {
	Write-Output $_.FullName
	$zip = $_.BaseName + ".zip"
	Compress-Archive -Path $_.FullName -DestinationPath $zip -Force
	Remove-Item $_.FullName
}

John Siu

Update: 2025-08-01
comments powered by Disqus