PowerShell can easily create zip archives of files and folders using the Write-Zip cmdlet.
Get-ChildItem C:\MyScripts\*.ps1 | Write-Zip -OutputPath C:\Temp\PS-scripts.zip
Here we zipped up all the PowerShell scripts written or downloaded for archive purposes:
Get-ChildItem also has a -Recurse parameter if we want to zip up subfolders, and the Write-Zip cmdlet has a -IncludeEmptyDirectories parameter if we want to, well, include empty directories.
No comments:
Post a Comment