commit dcd6fca9786c034a7bdc0e094add1d7da99c6733 parent 517694fc4a26acb945fd3e85298c250d4e071b93 Author: gearsix <gearsix@tuta.io> Date: Mon, 10 Jan 2022 17:06:40 +0000 bugfixes & improv. win/zipto7z.ps1 Diffstat:
M | win/zipto7z.ps1 | | | 16 | ++++++++++------ |
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/win/zipto7z.ps1 b/win/zipto7z.ps1 @@ -2,15 +2,19 @@ # DEPENDENCIES: requires 7z.exe to be in your $PATH Foreach ($zip in $(Get-ChildItem -Filter *.zip)) { Set-Variable -Name name -Value $zip.toString().TrimEnd(".zip") - Write-Output $name - Expand-Archive -Path $zip + If (Test-Path "$name.7z") { continue } + + Write-Output "$name" + Expand-Archive -Path "$zip" - Set-Directory $name - 7z a -mx9 $name + Set-Location "$name" + 7z a -mx9 "$name" Move-Item "$name.7z" .. Set-Location .. - Remove-Item $zip - Remove-Item $name -Recurse + If (Test-Path "$name.7z") { + Remove-Item "$zip" + Remove-Item "$name" -Recurse + } } \ No newline at end of file