Last active
October 4, 2019 04:23
-
-
Save yanonono/d15b5eb9869a4249b8e2df363098dd07 to your computer and use it in GitHub Desktop.
同じディレクトリ内のディレクトリをzipファイル(+更新日付)を作成する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Get-ChildItem -Directory | ForEach-Object{ | |
| $zipFilename = "{0}-{1}.zip" -f $_.Name, ($_.LastWriteTime).ToString("yyyyMMdd_HHmmss") | |
| if(Test-Path($zipFilename)) { | |
| Write-Host "Already ZIP File :" $_.Name | |
| } else { | |
| Write-Host "ZIP Compressing : $_.Name -> $zipFilename" | |
| Compress-Archive -Path $_.FullName -DestinationPath $zipFilename -CompressionLevel Optimal | |
| } | |
| } | |
| Read-Host "Complete!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment