0

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
5
  • 1
    The 'G' in '7zG' stands for the GUI version, while you need the batch version.
    – harrymc
    Apr 4, 2017 at 17:59
  • I sorta wanted to see a GUI, since this takes a long time. What is the name of the batch version @harrymc ?
    – Dr.YSG
    Apr 4, 2017 at 19:19
  • It's called 7z.exe.
    – harrymc
    Apr 4, 2017 at 19:23
  • Yea, that is what I already had working. 7z.exe. Don't you find it odd that it takes the same command arguments but does not do the same thing? 7z.exe works in a primitive way for me. I was hoping I could do the same thing with multiple invokation of 7zg.exe
    – Dr.YSG
    Apr 4, 2017 at 19:24
  • Yes, it seems unlikely. So I just tried 7zg a test.7z file1 and then 7zg a test.7z file2 and they worked just fine. I think you should debug the script (useful link).
    – harrymc
    Apr 4, 2017 at 20:08

0

You must log in to answer this question.

Browse other questions tagged .