xhj
2014-11-19 18:29:35 +08:00
你也许需要的是这个,把拖进去了的再拖出来?我写了个小脚本:
#!/usr/bin/env ruby
require 'nokogiri'
ibooks_home = '/Users/xxx/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/'
Dir.foreach(ibooks_home) do |dir|
if File.extname(dir) == ".epub"
dir = ibooks_home + dir
File.open(dir + "/iTunesMetadata.plist") do |f|
doc = Nokogiri::XML(f)
book_name = doc.xpath('//key[text()="itemName"]/following::string').first.text
Dir.chdir(dir)
print "." if %x(zip -r "#{book_name}.epub" .) && %x(mv "#{book_name}.epub" ~/Downloads/)
end
end
end
puts "Done!"