rubyzip problem / question

D

Dan

Hi,

I'm fairly new to ruby and am trying to use the rubyzip library (I
downloaded the latest gem) to change a directory name in a zipped file.
The code below seems to work (i.e. the directory names show as changed
in winzip), but I get "crc errors" when I try to actually decompress
the file. I'd really like to avoid the overhead of unzipping and
re-zipping each file. Any suggestions would be greatly appreciated!

require 'zip/zip'

target = "test.zip"

Zip::ZipFile.open(target) do |zipfile|
zipfile.each do |e|
if !e.directory? and e.to_s.include? "olddir"
zipfile.rename(e.to_s, e.to_s.gsub("olddir", "newdir"))
end
end
end

- Dan
 
J

Jérôme Loyet

Hi,

Hello
I'm fairly new to ruby and am trying to use the rubyzip library (I
downloaded the latest gem) to change a directory name in a zipped file.
The code below seems to work (i.e. the directory names show as changed
in winzip), but I get "crc errors" when I try to actually decompress
the file. I'd really like to avoid the overhead of unzipping and
re-zipping each file. Any suggestions would be greatly appreciated!

require 'zip/zip'

target = "test.zip"

Zip::ZipFile.open(target) do |zipfile|
zipfile.each do |e|
if !e.directory? and e.to_s.include? "olddir"
zipfile.rename(e.to_s, e.to_s.gsub("olddir", "newdir"))
end
end
end

I've got exactly the same problem. I sent the information to the
developers of rubyzip and they created a bug in the tracker.

Just in case, has someone found a solution of that ? Maybe an unknown
patch ? :)
Thanks in advance,
Regards,
++ Jerome
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top