11

I'm trying this:

7za.exe a "C:\Disc.7z" "C:\test" -v20000000b -m0=BCJ -bd

But if I already have created the file C:\Disc.7z then 7zip doesn't compress anything and sends me this output:

System error:
File already exist.

I've tried with the switch -y, but 7zip does not do anything...

How can I overwrite the file?


UPDATE

I've tried the switch -aoa but it does not work either...

assylias
  • 426

5 Answers5

13

Your problem is that you're using -v to create a multi-volume archive. People have been requesting the author for the last 5 years to allow the program to modify multi-volume archives, but he has no plans to implement the feature any time soon. (It's open source, wish some enterprising programmer would do it already!)

Karan
  • 57,289
6

Try using 7za.exe u instead of 7za.exe a. The first one is specifically used to update an archive that already exists.

user1301428
  • 3,435
  • 13
  • 40
  • 57
3

Currently there is no way to have this functionality with command line switches. Overwriting is supported only during archive extraction.

pabdulin
  • 1,756
2

Work-Around

To work around this problem, you could delete the archive files if they exist before you create them again. Here's one way to do this:

CMD /C FOR %i IN (C:\Disc.7z.???) DO DEL %i && 7za.exe a "C:\Disc.7z" "C:\test" -v20000000b -m0=BCJ -bd

Explanation

  • The CMD /C ensures that the 7za command is only executed once rather than for each file.
  • The FOR iterates through each destination archive file and deletes it. Note that the expression only covers volumes with three-digit suffixes. If you expect more (which I'm not sure is possible), you could replace the ??? with *.
  • The && runs the second command after the first (if the first is successful).
Sam
  • 1,476
1

I've noticed that this problem doesn't occur for me if I remove the -v switch. It appears that 7-Zip doesn't support updating archive volumes.

Sam
  • 1,476