Here is an odd one. I am am running 7-zip [64] version 16.04 on windows 10.
I have the following powershell script. the $zipper program is set to 7z.exe the script runs fine.
If I change the $zipper program to 7zg.exe then I get an error when creating running it for the second time in the script. It complains that the Gl.7z archive already exists!
As you can see, I am even trying to change the command from "a" to "u" (update) for the second folder (sherlock) but it that did not help. (I don't have to do that for 7z.exe).
What gives, and why is 7zg.exe different than 7z.exe?
clear-host
Set-Location $PSScriptRoot # set current directory to location of script
[string]$zipper = "$($Env:ProgramFiles)\7-Zip\7z.exe"
[Array]$archive = "GL.7z"
[Array]$flags = "a","-t7z","-mx1","-mmt=on","-ms=on", "-r"
[Array]$skip = "-xr!.svn","-xr!.vs","-xr!bin","-xr!obj","-xr!Properties","-x!*.csproj","-x!*.user","-x!*.sln","-x!*.suo","-x!web.config","-x!web.*.config"
if (Test-Path $archive) {
Remove-Item $archive
}
$startDate = Get-Date
Write-Output "starting at: $startDate"
$ElapsedTime = [System.Diagnostics.Stopwatch]::StartNew()
Write-Output "Toby............................................................................................"
[Array]$in = "..\Toby"
[Array]$cmd = $flags + $archive + $in + $skip
& $zipper $cmd
Write-Output "Sherlock............................................................................................"
[Array]$flags = "u","-t7z","-mx1","-mmt=on","-ms=on", "-r"
[Array]$in = "..\Sherlock"
[Array]$cmd = $flags + $archive + $in + $skip
& $zipper $cmd
exit
Write-Output "Watson............................................................................................"
[Array]$in = "..\Watson"
[Array]$wskip = "-xr!.svn","-xr!.svn", "-xr!obj", "-x!*.md", "-x!watson.log*.json", "-x!*.sln", "-x!*.suo", "-x!*.njsproj", "-x!*.dat", "-x!*.md", "-x!*LICENSE*", "-x!*.yml", "-x!*.git*", "-x!.npm*", "-x!*.c", "-x!*.txt", "-x!Makefile", "-x!.jshint*", "-x!readme*"
[Array]$cmd = $flags + $archive + $in + $wskip
& $zipper $cmd
Write-Output "Doc............................................................................................"
[Array]$in = "..\doc"
[Array]$cmd = $flags + $archive + $in + $skip
& $zipper $cmd
Write-Output "Setup............................................................................................"
[Array]$in = "..\setup"
[Array]$cmd = $flags + $archive + $in + $skip
& $zipper $cmd
exit
Write-Output "Base Maps Files............................................................................................"
[Array]$in = "..\BaseMaps"
[Array]$cmd = $flags + $archive + $in + $skip
& $zipper $cmd
write-host "Total Elapsed Time: $($ElapsedTime.Elapsed.ToString())"
# list files:
# &$zipper l $archive
# 7z e archive.zip -oc:\soft *.cpp -r
7z.exe
.7zg a test.7z file1
and then7zg a test.7z file2
and they worked just fine. I think you should debug the script (useful link).