If when the .rar file is extracted out and each folder contains "_ _ contents_ _.xml", then you can use the restore functionality from the java admin client.
If it does not, then you can use the following. (I have not tested the code and wrote it on the fly.) Launch eXide from the dashboard. Log in as admin and then copy the code below into the ide and then run it.
The code has some functions copied from Priscilla Walmsley's FUNCTX function module. http://www.xqueryfunctions.com/
xquery version "3.0";
declare namespace file="http://exist-db.org/xquery/file";
(:~
: Escapes regex special characters
:
: @author Priscilla Walmsley, Datypic
: @version 1.0
: @see http://www.xqueryfunctions.com/xq/functx_escape-for-regex.html
: @param $arg the string to escape
:)
declare function local:escape-for-regex( $arg as xs:string? ) as xs:string {
replace($arg, '(\.|\[|\]|\\|\||\-|\^|\$|\?|\*|\+|\{|\}|\(|\))','\\$1')
} ;
(:~
: The substring before the last occurrence of a delimiter
:
: @author Priscilla Walmsley, Datypic
: @version 1.0
: @see http://www.xqueryfunctions.com/xq/functx_substring-before-last.html
: @param $arg the string to substring
: @param $delim the delimiter
:)
declare function local:substring-before-last( $arg as xs:string?, $delim as xs:string ) as xs:string {
if (matches($arg, local:escape-for-regex($delim)))
then replace($arg,
concat('^(.*)', local:escape-for-regex($delim),'.*'),
'$1')
else ''
} ;
(:~
: The substring after the last occurrence of a delimiter
:
: @author Priscilla Walmsley, Datypic
: @version 1.0
: @see http://www.xqueryfunctions.com/xq/functx_substring-after-last.html
: @param $arg the string to substring
: @param $delim the delimiter
:)
declare function local:substring-after-last
( $arg as xs:string? ,
$delim as xs:string ) as xs:string {
replace ($arg,concat('^.*',local:escape-for-regex($delim)),'')
} ;
declare function local:import($base as xs:string, $path as xs:string) {
let $offset := fn:substring-after($path, $base)
return
if (file:is-directory($path))
then
let $created := xmldb:create-collection('/', '/')
let $coll := for $resource in file:list($path)
return local:import($base, $path || '/' || $resource)
return $path
else
let $collection : = local:substring-before-last($offset, '/')
let $resource : = local:substring-after-last($offset, '/')
let $stored := xmldb:store($collection, $resource,
file:read-binary($path), 'application/octet-stream')
let $permission := if (fn:ends-with($resource, ".xq"))
then sm:chmod($collection || '/' || $resource, 'rwxr-xr-x')
else ()
return $path
};
let $base := '/tmp/lctmp'
let $path := '/tmp/lctmp/db'
return local:import($base, $path)