Abraham P
Abraham P

Reputation: 15471

Create directories if not exist Nuxeo

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
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?

Upvotes: 1

Views: 520

Answers (1)

Vincent Dutat
Vincent Dutat

Reputation: 11

The value of 'path' does not need to start with "doc:". The target folder MUST exist.

Upvotes: 1

Related Questions