I'm writing a script that is adding some files to an existing zip with 7zip, but if there is a file match the file inside the zip will be overwritten. I don't want that, if the file with the same name is already there i want to skip it.
My code now is something like that:
%zipPath% a %zipfile% "%%~F"
Any ideas? :)
There is a complete set of options to determine how to update the contents of the file. See -u (update options)
in 7z help. The parameters you probably need are
7z a -up1q1r2x1y1z1w1 zipfile filesToAdd
Which keeps in archive (the 1 in the switch) files in case of no match (p), file does not exist on disk (q), file in archive is newer than on disk (x), file in archive is older than on disk (y), file in archive is the same that on disk (z), or if it can't be determined (w). In case of file not in archive (r), it is compressed (2).
Seems complicated, but it is perfectly documented in 7zip help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With