viewpoint-particle

Author Topic: zzipfiles  (Read 4014 times)

bmcnish

  • Newbie
  • *
  • Posts: 3
zzipfiles
« on: May 16, 2014, 06:02:17 am »
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.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: zzipfiles
« Reply #1 on: May 16, 2014, 08:26:29 am »
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:
Code: [Select]
7z d archive.zip *.bak -r
Use the WinBatch ShellExecute function to execute the above command line.
Deana F.
Technical Support
Wilson WindowWare Inc.

snowsnowsnow

  • Sr. Member
  • ****
  • Posts: 330
Re: zzipfiles
« Reply #2 on: May 16, 2014, 09:09:21 am »
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?

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: zzipfiles
« Reply #3 on: May 16, 2014, 09:33:10 am »
Turns out I was wrong. The Extender function zZipFiles supports a 'delete' option.

Code: Winbatch
;Deletes a specific file from the .zip
AddExtender("WWZIP44I.DLL",0,"WWZIP64I.DLL")
xzipper=zZipFiles("d", "C:\TEMP\test.zip", "dummy.txt", "")
 

Code: Winbatch
;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!!!!!!!!!!!!!!!!!!
Deana F.
Technical Support
Wilson WindowWare Inc.

snowsnowsnow

  • Sr. Member
  • ****
  • Posts: 330
Re: zzipfiles
« Reply #4 on: May 16, 2014, 09:40:58 am »
Quote
So in Fact: WinBatch can do it!!!!!!!!!!!!!!!!!!

Yey!  My faith is restored.

bmcnish

  • Newbie
  • *
  • Posts: 3
Re: zzipfiles
« Reply #5 on: May 16, 2014, 10:29:14 am »
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.

Deana

  • Wilson WindowWare Tech Support
  • Pundit
  • *****
  • Posts: 1183
  • WinBatch® can do it.
    • WinBatch Tech Support Database
Re: zzipfiles
« Reply #6 on: May 16, 2014, 10:37:27 am »
Help file will be updated with an example.
Deana F.
Technical Support
Wilson WindowWare Inc.