For those that are interested, a directory can be created by using MLJAM to 
make a call out to Java to do the directory creation.  You will need to setup 
MLJAM (see http://developer.marklogic.com/howto/tutorials/2006-05-mljam.xqy)  
The code below can then be used to do the directory creation.  (Obviously you 
will need to change it to match your environment)

David



xquery version "0.9-ml"
module "http://mySite.createDir";
declare namespace dir = "http://mySite.createDir";

import module namespace jam = "http://xqdev.com/jam"; at "/modules/jam.xqy"

define function createDirectory($directory) {
                jam:start("http://localhost:8080/mljam/mljam";, "mljam", 
"secret"),
                jam:set("newDirectory", $directory),
                jam:eval('
                        import java.io.*;

                        // Create one directory
                        boolean success = (new File(newDirectory)).mkdir();
                        if (success) {
                                System.out.println("Directory: " + newDirectory 
+ " created");
                        }
                '),
                jam:get("success"),
                jam:end()
}




-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Michael Blakeley
Sent: Thursday, December 11, 2008 1:11 PM
To: General Mark Logic Developer Discussion
Subject: Re: [MarkLogic Dev General] xdmp:directory-create() doesn't seem to 
work

Not directly, no. Depending on what you're doing, you might want to look 
into XQSync 
(http://developer.marklogic.com/howto/tutorials/2006-08-xqsync.xqy).

Another possibility is to write a simple web service, in a language of 
your choice, that performs the directory-create on demand. Your XQuery 
could POST a directory name to it, using xdmp:http-post().

-- Mike

On 2008-12-11 09:00, David Scott Gurney wrote:
> Thanks - that clarifies why I'm not seeing any directories created on the 
> file system.
>
> What I really want to do is the ability to create a directory in the file 
> system so that I can write a file to it with xdmp:save()
>
> xdmp:save() works very well as long as the directory already exists - hence 
> the need to create the directory before performing the save operation.
>
> It looks like xdmp:filesystem-directory will only give a listing of files 
> within an already existing directory. (not create one)
>
> Is there a function to create a directory on the file system?
>
> Thanks
> David
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Michael Blakeley
> Sent: Thursday, December 11, 2008 9:45 AM
> To: General Mark Logic Developer Discussion
> Subject: Re: [MarkLogic Dev General] xdmp:directory-create() doesn't seem to 
> work
>
> xdmp:directory-create() creates a directory in the current database. It
> may be that
> http://developer.marklogic.com/pubs/4.0/apidocs/UpdateBuiltins.html#xdmp:directory-create
> isn't clear enough about this.
>
> Perhaps you want
> http://developer.marklogic.com/pubs/4.0/apidocs/AdminBuiltins.html#xdmp:filesystem-directory
> instead?
>
> -- Mike
>
> On 2008-12-11 08:22, David Scott Gurney wrote:
>> The following code does not actually create any directories - nor does it 
>> throw any errors.
>>
>> xquery version "1.0-ml";
>>
>> xdmp:directory-create("test1/"),
>> xdmp:directory-create("/test2/"),
>> xdmp:directory-create("C:\Program Files\MarkLogic\test3/"),
>> xdmp:directory-create("C:/Program Files/MarkLogic/test4/"),
>> xdmp:directory-create("C:/Program Files/MarkLogic/test5/", 
>> xdmp:default-permissions()),
>> xdmp:directory-create("C:\Program Files\MarkLogic\test6/", 
>> xdmp:default-permissions()),
>> xdmp:directory-create("C:/tmp/test7/", xdmp:default-permissions()),
>> xdmp:directory-create("C:\tmp\test8/", xdmp:default-permissions())
>>
>>
>> This is on WindowsXP with ML version 4.0-1
>>
>> Am I doing something wrong, or is this functionality broken?  It appears 
>> that both relative and absolute paths do not work.
>>
>> Thanks,
>> David
>>
>>
>>    NOTICE: This email message is for the sole use of the intended 
>> recipient(s) and may contain confidential and privileged information. Any 
>> unauthorized review, use, disclosure or distribution is prohibited. If you 
>> are not the intended recipient, please contact the sender by reply email and 
>> destroy all copies of the original message.
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://xqzone.com/mailman/listinfo/general
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> General mailing list
> [email protected]
> http://xqzone.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to