Hi Christian,

thanks a lot, looks fine! I've just added a where clause to filter for files only, leaving out directories:

let $root := '/mnt/baseX_files/iu_test2/'
let $db := 'IU_Test'
for $path in file:list($root, true())
where file:is-file($root || $path)
return if(db:exists($db, $path)) then (
  db:put($db, doc($root || $path), $path)
) else (
  db:add($db, doc($root || $path), $path)
)

Works like a charm!

Yours
Florian