1
我有一個zip文件,它在第一個'級別'只包含目錄。類似:在打開的zip文件中的cd目錄
some_file.zip
/打開的文件(級別1)
- >目錄/
/2級
- > file.txt的
- > file2.txt
有人可以寫代碼如何cd
到Directory\
並列出所有條目?
我已經寫代碼,但它不工作:
require 'zip/zipfilesystem'
Zip::ZipFile.open("./some_file.zip") do |zipfile|
zipfile.each_with_index do |file, index|
puts "inspect file == #{file.inspect}"
puts "entries == #{ zipfile.entries }"
entries = zipfile.entries
puts "zipfile.open file #{ zipfile.read(file) }"
end
end
PS我用rubyzip
https://github.com/aussiegeek/rubyzip
您的權利。我打開了一個空的ZIP文件。 :d – 2012-04-24 08:33:01