Wiki source for MarkLogicDirexists

Show raw source

======Mark Logic Command: direxists======
Detects if a directory exists on a Mark Logic server

direxists [-c uri|-connect uri] directory

Checks to see if a directory (uri) exists on a MarkLogic server. Directory URI's must end in slash (/)

||-c,-connect uri||Use the connection string instead of $MLCONNECT||
||directory|| uri of the direct to check||

Assuming the prefix "ml" is imported as the marklogic module, tests to see if the directory /test/ exists

if ml:direxists /test/ ; then
echo /test/ exists
echo /test/ doesnt exist

Example, safely delete /test/ only if it exists

ml:direxists /test/ && ml:deldir /test/

To check if a document (file) exists use [[MarkLogicExists exists]]

direxists is implemented as an xsh script which simply calls xdmp:document-properties. The source of the script is

# return true if diretory exists else return false
_opts=$<(xgetopts -a -p "c=connect:" -ps -- "$@")
shift $?

:query $_opts -b -q <{{
declare variable $uri external ;
}}> -v uri $1

[[ModuleMarkLogic MarkLogic Extension Module]]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki