I need to know who to delete a list of files from an existing zip file. I cannot unzip the entire file first. I just want to delete certain files.
Sorry no built in support for this in WinBatch or the Zipper extender. That is not to say it isn't possible, but the code to accomplish it could be quite complex. Reference: http://stackoverflow.com/questions/5244963/delete-files-from-a-zip-archive-without-decompressing-in-java-or-maybe-python
You might consider using a command line tool that knows how to handle this for you. For example: 7-Zip command line supports the command line option "d". This stands for 'delete' . It allows you to remove a certain file (or set of files) from inside an archive.
To remove all .bak files from a .zip file:
7z d archive.zip *.bak -r
Use the WinBatch ShellExecute function to execute the above command line.
1) Kind of funny that your tag line (next to your avatar) says "Winbatch can do it", while your text says that it can't.
2) (But seriously folks, ââ,¬Â¦) I am a little surprised to hear that there is no "delete" capability in the Zipper Extender. Intuitively, the Zipper Extender is just an Extender wrapper around the Info Zip programs, so, in theory at least, anything the "zip" and "unzip" programs can do, the ZE should be able to do.
I have a vague memory of something similar having coming up before - specifically, the often recurring question of encryption - and a fairly long discussion emerged between people who maintained, as I did above, that anything the underlying IZ programs can do, the ZE should be able to do, and the Winbatch support people maintaining that there were good reasons (namely, US Export laws) for not doing it.
Anyway, is there any reason not to include the "d" functionality in the ZE?
Turns out I was wrong. The Extender function zZipFiles supports a 'delete' option.
;Deletes a specific file from the .zip
AddExtender("WWZIP44I.DLL",0,"WWZIP64I.DLL")
xzipper=zZipFiles("d", "C:\TEMP\test.zip", "dummy.txt", "")
;Deletes all .bak files from the .zip
AddExtender("WWZIP44I.DLL",0,"WWZIP64I.DLL")
xzipper=zZipFiles("d", "C:\TEMP\test.zip", "*.bak", "")
Pause('Deleted',xzipper)
So in Fact: WinBatch can do it!!!!!!!!!!!!!!!!!!
QuoteSo in Fact: WinBatch can do it!!!!!!!!!!!!!!!!!!
Yey! My faith is restored.
thanks people. it worked. My script builds a bar delimited list of files to be removed, which goes in the zZipFiles command. My original zip had 256 files, 34 to be deleted, giving 222 file now in the zip. Be nice if the WindowWare people would update the help file with the example given by Deana.
Help file will be updated with an example.