There seems to be no way to delete/remove files from an archive

Issue #9 resolved
created an issue

... Or else I'm just failing to find it by inspecting the methods or reading the docs.

I was hoping for something like:' do |a|

Does it really not provide this functionality? Seems to do everything else.

Comments (3)

  1. silasdavis reporter

    Yes there is, will add to wiki when I get a chance, also was ignorant of how ZIP files only store files and their paths as entries. I was expecting zipruby to have populated a hash table of entries on open, but it doesn't, which on reflection is a good thing in case you only want to scan once and not have the overhead.

    Here's an example of deleting a directory:

 do |ar|
            delete_pattern = dir_pattern('META-INF')
            n = ar.num_files # number of entries
            n.times do |i|
              entry_name = ar.get_name(i) # get entry name from archive
              ar.fdelete(i) if delete_pattern === entry_name
  2. Log in to comment