Revision [1483]

This is an old revision of MarkLogicDirexists made by DavidLee on 2010-07-10 08:52:31.

 

Mark Logic Command: direxists

Detects if a directory exists on a Mark Logic server

Synopsis

direxists [-c uri|-connect uri] document [document ...]

Description

Deletes documents residing on a Mark Logic server.
Documents are specified by the URI used to store the document

-c,-connect uriUse the connection string instead of $MLCONNECT
document uri of the document to delete

Example

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
else
	echo /test/ doesnt exist
fi


Example, safely delete /test/ only if it exists

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



To check if a document (file) exists use exists

Implementation


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 ;  
exists(xdmp:document-properties($uri)//prop:directory)
}}> -v uri $1








MarkLogic Extension Module
There are no comments on this page.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki