Hi Marc,
I do a JCR export and then use this ugly little script to reconstitute the
binaries.
Just pipe the export to the script. Binaries will be put in directory ‘output’
#!/usr/bin/env ruby
require 'nokogiri'
require 'base64'
doc = Nokogiri::XML( ARGF.read )
dir = "output"
Dir.mkdir dir unless Dir.exists? dir
doc.xpath("//sv:node[@*='jcr:content']").each do |node|
filename = node.xpath("sv:property[@*='fileName']/sv:value").text.downcase
extension = node.xpath("sv:property[@*='extension']/sv:value").text.downcase
data = node.xpath("sv:property[@*='Binary']/sv:value").text
path = "#{dir}/#{filename}.#{extension}"
path.gsub!( /(\.#{extension})+/, ".#{extension}" )
File.open( path, 'wb+').write( Base64.decode64(data) )
end
--
Cheers!
Zak Greant / Sr. Technical Evangelist
Magnolia
Oslo-Strasse 2, 4142 Münchenstein (Basel), Switzerland
Office: +41 61 228 90 00 www.magnolia-cms.com
----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------