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'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