Hi all - I'm wondering if you all would share better ways to approach the following problem: I have a directory of files but I only want to put a subset of the files into a BaseX database. After some fumbling around, I have these two approaches, but... what are your thoughts? Can I simplify this somehow? I struggled initially with filtering the files down - while I know I could have thrown everything in the directory into a db, there are some fairly large binaries and disk space is precious :) - so I couldn't get a way forward through using commands, but maybe I overlooked something. Thanks for your time! Best, Bridger #1 (: relies on running 'CREATE DATABASE cco' as a first step :) declare variable $path := "/home/bridger/Downloads/cco/"; for $m in file:list($path, false(), '*.txt')[starts-with(., 'retrospect-')] let $n := substring-after(substring-before($m, '.txt'), 'cob-') let $t := element text { file:read-text($path || $m, 'UTF-8', true()) return updating db:add(?, ?, ?)('cco', $t, $n) #2 declare variable $path := "/home/bridger/Downloads/cco/"; declare variable $filepaths := file:list($path, false(), '*.txt')[starts-with(., 'retrospect-')]; declare variable $files := ( for $f in $filepaths let $t := element text { file:read-text($path || $f, 'UTF-8', true()) } return $t ); declare variable $names := ( for $f in $filepaths let $n := substring-after(substring-before($f, '.txt'), 'cob-') return $n ); db:create( 'nothertest', $files, $names, { 'ftindex': true(), 'textindex': true() } )