7zip command line options for more information when synchronizing
Solution 1
7zip does not have "extra verbosity" option. But you could use 7zip SDK and write a simple wrapper around the library to do what you want.
Solution 2
Why would you need that? I mean, the -u
flag is precisely designed to have a fine grained control over the archive update.
"C:\Program Files\7-Zip\7z.exe" -ms=off -uq0 u "C:\Docz.7z" "C:\Documentsx\*"
will update Docz.7z
adding and deleting files provided you created the archive with the -ms=off
switch (otherwise you won't be able to delete files). If you ever need to compare what you have in C:\Documentsx\
with what there is in the archive, you'll have either to write a wrapper as said by Alex P., or write script with whatever you want to do the comparison between the list of files in C:\Documentsx\
and the output of 7z l Docz.7z
.
For instance, using the command line under Linux (which can be transformed into a script):
7z l Docz.7z | cut -c54-80 | sed -n -E '/---/,/---/p' | sed '/---/d' | sort > Docz.list
ls Documents/* | sort > Documents.list
diff Docz.list Documents.list
I know you don't use Linux, but you can use that bash script as a basis for your own.
But could you tell us a bit more about the background and about what you try to achieve? You might have chosen a wrong path...
Related videos on Youtube
VSP
Updated on September 18, 2022Comments
-
VSP almost 2 years
In the 7zip command line options, is there some argument that can make 7z output the files ignored/deleted from the archive too? (files ignored by the option
-uq0
)Example call:
"C:\Program Files\7-Zip\7z.exe" u "C:\Docz.7z" -uq0 "C:\Documentsx\*"
7zip Verbose:
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning Updating archive C:\Docz.7z Compressing hello.txt Everything is Ok
If the archive is added or replaced it says "Compressing hello.txt"
I would like to get more info or verbose...something like this:
7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 Scanning Updating archive C:\Docz.7z Updating hello.txt Adding examplenew.txt Deleting/Ignoring documentdeleted.txt Everything is Ok
-
VSP over 11 yearsNot factible right now. It would have to be developed and maintained throught future 7zip versions and so on (We dont have the resources for this option) :S
-
VSP over 11 yearsWe use this command to sincronize a folder to a .zip file that will be included in an exe application. This command is called from visual studio prebuild command option... The idea was to get a litte more info of the changes since the last exe build at a glance: files adds, files updated, files deleted... Internally 7zip knows this already when running with the file sync/update flag, we only need it to show this info to us...
-
Admin over 11 yearsPlease don't get me the wrong way, but isn't that one of the most useful feature of a version control system? Tracking files... If you are using a prebuild command, why don't you use such a script to get the diff? If the number of files is reasonably small, you can also call
7z l Docz.7z
right before the update and right after. But once again, I don't really see the point. But if you really want it this way, just make a patch and submit it. I don't think 7zip folks would turn it down. -
VSP over 11 yearsWe only needed it as extra information when compiling, so its not so important as to using a vcs or developing an extra script for that info...We added it as suggestion in the 7zip issue tracker so wish us luck ^^