Loading TOC...

MarkLogic 12 EA 2 Product Documentation
xdmp:filesystem-directory

xdmp:filesystem-directory(
   $pathname as xs:string
) as element(dir:directory)

Summary

Performs a directory listing of the given file pathname.

Parameters
pathname Pathname of the directory to be listed.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-filesystem-directory

Usage Notes

The user under which MarkLogic Server is running must have permissions to read the specified directory. For example, on Windows systems, MarkLogic Server typically runs as the SYSTEM user, and therefore the SYSTEM user must have permissions to read the directory (even a mapped network drive directory). Similarly, on UNIX systems, MarkLogic Server typically runs as the daemon user, and that user needs to have read permission to the specified directory. If the user in which MarkLogic Server runs does not have the needed permissions, then an error such as SVC-DIROPEN or SVC-FILOPN is thrown when you attempt to call this built-in.

Example

xdmp:filesystem-directory("/etc")
=>
<dir:directory
   xmlns:dir="http://marklogic.com/xdmp/directory"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://marklogic.com/xdmp/directory directory.xsd">
   <dir:entry>
      <dir:filename>rpm</dir:filename>
      <dir:pathname>/etc/rpm</dir:pathname>
      <dir:type>directory</dir:type>
      <dir:content-length>4096</dir:content-length>
      <dir:last-modified>2015-03-12T18:23:56-07:00</dir:last-modified>
   </dir:entry>
   <dir:entry>
      <dir:filename>sudoers.d</dir:filename>
      <dir:pathname>/etc/sudoers.d</dir:pathname>
      <dir:type>directory</dir:type>
      <dir:content-length>4096</dir:content-length>
      <dir:last-modified>2015-02-18T02:02:00-08:00</dir:last-modified>
   </dir:entry>
   ...
</dir:directory>

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.