Changes

Jump to navigation Jump to search
992 bytes added ,  08:38, 26 September 2022
| '''Errors'''
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
|- valign="top"
| '''Examples'''
| Return the contents of large {Code|.txt} files located in a specific directory and its subdirectories:
<syntaxhighlight lang="xquery">
let $root := 'path/to/files/'
for $file in file:list($root, true(), '*.txt')
let $path := $root || $file
where file:size($path) > 1000000
return file:read-text($path)
</syntaxhighlight>
|}
| '''Errors'''
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
|- valign="top"
| '''Examples'''
| Return the contents of large {Code|.txt} files located in a specific directory:
<syntaxhighlight lang="xquery">
for $file in file:children('path/to/files/')
where matches($file, '.txt', 'i') and file:size($file) > 1000000
return file:read-text($$file)
</syntaxhighlight>
|}
| '''Errors'''
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
|- valign="top"
| '''Examples'''
| Return the contents of all {Code|.txt} files located in a specific directory and its subdirectories:
<syntaxhighlight lang="xquery">
for $file in file:descendants('path/to/files/')
where matches($file, '.txt', 'i') and file:size($file) > 1000000
return file:read-text($$file)
</syntaxhighlight>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu