Hi,

There is a file with uri /error/file.xml, the attached code, it deletes the
file, then a query is made to check if there are files remaining in the
folder, if there are no more files then it deletes the folder.
The problem is that the folder is not getting deleted. Any ideas why?
Keep in mind that if there are other files in the folder it shouldn't be
deleted.

let $uri := "/error/file.xml"
let $fileName := fn:tokenize($uri, "/")[fn:last()]
let $folder := fn:tokenize($uri, $fileName)[1]
let $delete-file := xdmp:document-delete($uri)
return
    if(fn:not(xdmp:directory-properties($folder,
"infinity")[fn:not(.//prop:directory)])) then
        xdmp:directory-delete($folder)
    else ()

Regards,

-- 
*Dayro Longas*
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to