A module for performing various operations on files and directories stored in the server file system.
file:delete($path as item()) as xs:boolean
Delete a file or directory. This method is only available to the DBA role.
$path | The full path or URI to the file |
file:directory-list($path as item(), $pattern as xs:string*) as node()?
List all files, including their file size and modification time, found in or below a directory, $directory. Files are located in the server's file system, using filename patterns, $pattern. File pattern matching is based on code from Apache's Ant, thus following the same conventions. For example:
'*.xml' matches any file ending with .xml in the current directory,
- '**/*.xml' matches files in any directory below the specified directory. This method is only available to the DBA role.
$path | The base directory path or URI in the file system where the files are located. |
$pattern* | The file name pattern |
file:exists($path as item()) as xs:boolean
Tests if a file or directory exists. This method is only available to the DBA role.
$path | The full path or URI to the file in the file system |
file:is-directory($path as item()) as xs:boolean
Tests if a path is a directory. This method is only available to the DBA role.
$path | The full path or URI to the file or directory |
file:is-readable($path as item()) as xs:boolean
Tests if a file is readable. This method is only available to the DBA role.
$path | The full path or URI to the file |
file:is-writeable($path as item()) as xs:boolean
Tests if a file is writeable. This method is only available to the DBA role.
$path | The full path or URI to the file |
file:list($path as item()) as node()*
List all files and directories under the specified directory. This method is only available to the DBA role.
$path | The directory path or URI in the file system. |
file:mkdir($path as item()) as xs:boolean
Create a directory. This method is only available to the DBA role.
$path | The full path or URI to the directory |
file:mkdirs($path as item()) as xs:boolean
Create a directory including any necessary but nonexistent parent directories. This method is only available to the DBA role.
$path | The full path or URI to the directory |
file:move($original as item(), $destination as item()) as xs:boolean
Move (rename) a file or directory. Exact operation is platform dependent. This method is only available to the DBA role.
$original | The full path or URI to the file |
$destination | The full path or URI to the file |
file:read($path as item()) as xs:string?
Reads the content of file. This method is only available to the DBA role.
$path | The directory path or URI in the file system. |
file:read($path as item(), $encoding as xs:string) as xs:string?
Reads the content of file. This method is only available to the DBA role.
$path | The directory path or URI in the file system. |
$encoding | The encoding type for the file |
file:read-binary($path as item()) as xs:base64Binary?
Reads the contents of a binary file. This method is only available to the DBA role.
$path | The directory path or URI in the file system. |
file:read-unicode($path as item()) as xs:string?
Reads the contents of a file. Unicode BOM (Byte Order Marker) will be stripped off if found. This method is only available to the DBA role.
$path | The directory path or URI in the file system. |
file:read-unicode($path as item(), $encoding as xs:string) as xs:string?
Reads the contents of a file. Unicode BOM (Byte Order Marker) will be stripped off if found. This method is only available to the DBA role.
$path | The directory path or URI in the file system. |
$encoding | The file is read with the encoding specified. |
file:serialize($node-set as node()*, $path as item(), $parameters as item()*) as xs:boolean?
Writes the node set into a file on the file system. $parameters contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from. This method is only available to the DBA role.
$node-set* | The contents to write to the file system. |
$path | The full path or URI to the file |
$parameters* | The serialization parameters: either a sequence of key=value pairs or an output:serialization-parameters element as defined by the standard fn:serialize function. |
file:serialize($node-set as node()*, $path as item(), $parameters as item()*, $append as xs:boolean) as xs:boolean?
Writes the node set into a file on the file system, optionally appending to it. $parameters contains a sequence of zero or more serialization parameters specified as key=value pairs. The serialization options are the same as those recognized by "declare option exist:serialize". The function does NOT automatically inherit the serialization options of the XQuery it is called from. This method is only available to the DBA role.
$node-set* | The contents to write to the file system. |
$path | The full path or URI to the file |
$parameters* | The serialization parameters: either a sequence of key=value pairs or an output:serialization-parameters element as defined by the standard fn:serialize function. |
$append | Should content be appended? |
file:serialize-binary($binarydata as xs:base64Binary, $path as item()) as xs:boolean
Writes binary data into a file on the file system. This method is only available to the DBA role.
$binarydata | The contents to write to the file system. |
$path | The full path or URI to the file |
file:serialize-binary($binarydata as xs:base64Binary, $path as item(), $append as xs:boolean) as xs:boolean
Writes binary data into a file on the file system, optionally appending the content. This method is only available to the DBA role.
$binarydata | The contents to write to the file system. |
$path | The full path or URI to the file |
$append | Should content be appended? |
file:sync($collection as xs:string, $targetPath as item(), $dateTimeOrOptionsMap as item()?) as document-node()
Synchronize a collection with a directory hierarchy.This method is only available to the DBA role.
Read more$collection | Absolute path to the collection to synchronize to disk. |
$targetPath | The path or URI to the target directory. Relative paths resolve against EXIST_HOME. |
$dateTimeOrOptionsMap? | Options as map(*). The available settings are:"prune": delete any file/dir that does not correspond to a doc/collection in the DB. "after": only resources modified after this date will be taken into account."excludes": files on the file system matching any of these patterns will be left untouched.(deprecated) If the third parameter is of type xs:dateTime, it is the same as setting the "after" option. |