cancel
Showing results for 
Search instead for 
Did you mean: 

Create directories if not exist Nuxeo

abe_
Champ in-the-making
Champ in-the-making

I am attempting to do a document.copy on an existing document, with the assumption that if the directories I am copying into may or may not exist. What would be a good way to achieve that?

 client = new nuxeo.Client(nuxeoParams)
 client.connect()
 copyOp = client.operation("Document.Copy")
 path = "doc:#{devConfig.path}#{devConfig.username}/#{devConfig.env}"/file.title
 var copyParams =
      { target: "doc:#{devConfig.path}#{devConfig.username}/#{devConfig.env}/documents/#{documentId}/" }
 copyOp.input(path).params(copyParams)
 copyOp.execute(function(error, data){
 if(error){
    console.debug('error')
 }else{
    console.debug('data')
 }
})

This 404s. What would be a way to avoid this and create the directories necessary in a lazy manner?

1 REPLY 1

Steven_Huwig1
Star Contributor
Star Contributor

I ended up catching the 404s and creating the directories as needed. It was pretty verbose, so I'd welcome anyone showing a better way.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.