As file:list only returns relative file paths, you will have to prepend the root path later on:
let $root := "/home/bengbers/DataScience/RBaseX/Examples/Parse/"
for $file in file:list($root, false(), "*.csv")
return db:add("CSV_test", $root || $file, "", map {
'parser': 'csv',
'csvparser': map { 'header': 'yes', 'separator': ';' }
})
Another alternative is to use the file:children function:
let $root := "/home/bengbers/DataScience/RBaseX/Examples/Parse/"
for $path in file:children($root)[ends-with(., ".csv")]
return db:add("CSV_test", $path, "", map { ... })
Cheers,