Changes

Jump to navigation Jump to search
72 bytes removed ,  18:29, 1 December 2023
m
Text replacement - "<syntaxhighlight lang="xquery">" to "<pre lang='xquery'>"
| '''Examples'''
| Return the contents of large {Code|.txt} files located in a specific directory and its subdirectories:
<syntaxhighlight pre lang="'xquery"'>
let $root := 'path/to/files/'
for $file in file:list($root, true(), '*.txt')
| '''Examples'''
| Return the contents of large {{Code|.txt}} files located in a specific directory:
<syntaxhighlight pre lang="'xquery"'>
for $file in file:children('path/to/files/')
where matches($file, '.txt', 'i') and file:size($file) > 1000000
| '''Examples'''
| Return the contents of all {{Code|.txt}} files located in a specific directory and its subdirectories:
<syntaxhighlight pre lang="'xquery"'>
for $file in file:descendants('path/to/files/')
where matches($file, '.txt', 'i') and file:size($file) > 1000000
</syntaxhighlight>
* or as map, which contains all key/value pairs:
<syntaxhighlight pre lang="'xquery"'>
map { "method": "xml", "cdata-section-elements": "div", ... }
</syntaxhighlight>
| '''Examples'''
|When renaming a file, remember that relative file paths are resolved against the current working directory. Some ways to rename:
<syntaxhighlight pre lang="'xquery"'>
file:move('/projects/new/octopus', '/projects/new/septimus')
</syntaxhighlight>
<syntaxhighlight pre lang="'xquery"'>
$path ! file:move(., file:parent(.)||$newName)
</syntaxhighlight>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu