Jonathan -
apologies for misreading your email! I'm not well-versed in the .bxs COMMAND syntax, but maybe this is closer?
I couldn't quite get a handle on using the EXECUTE syntax for this, but I'm under-caffeinated :)

Another piece of uncertainty: can you pass variables from the .bxs to a script you are RUNning? Maybe Christian can help us both understand some things!

Best,
Bridger

test-tsv.bxs
```
CREATE DB test-tsv
RUN /home/bridger/test-tsv.xq
LIST test-tsv
```
test-tsv.xq
```
for $T in file:children("/home/bridger/tsvs/")
let $TSV := csv:doc($T, map { "format": "direct", "separator": "tab", "header": true() })
let $TSV-NAME := file:name($T)
return db:add("test-tsv", $TSV, "/" || $TSV-NAME)
```
note: you could specify a db path here; e.g. db:add("test-tsv", $TSV, "/tsv-files/" || $TSV-NAME)

I've attached my two sample TSV files if that helps.


On Tue, Oct 12, 2021 at 11:45 AM Jonathan Robie <jonathan.robie@gmail.com> wrote:
Thanks!  I was getting hung up trying to do this in a command.

Jonathan

On Tue, Oct 12, 2021 at 11:44 AM Jonathan Robie <jonathan.robie@gmail.com> wrote:


On Tue, Oct 12, 2021 at 10:33 AM Bridger Dyson-Smith <bdysonsmith@gmail.com> wrote:
Hi Jonathan,

for $T in file:list($path-to-your-files)
let $TSV := csv:parse($T, map { 'separator': 'tab', 'header': true(), 'format': 'direct' })
return db:add($your-db, $TSV)

maybe? I'm probably getting something wrong, semantics-wise, w/ `db:add()`, but maybe it's close to get started?
Best,
Bridger

On Tue, Oct 12, 2021 at 9:31 AM Jonathan Robie <jonathan.robie@gmail.com> wrote:
I have a command file that configures a database, throwing a bunch of sources into various paths.

I have a set of TSV files. I want to do the equivalent of ADD TO, pointing to a directory of TSV files, so that they are parsed and converted to XML and placed in the appropriate path.

How do I do that?

Jonathan