I am trying to move a document to a destination folder using javascript API.
The problem is if the document with same name already exists in the repository, the move does not work and throws error.
is there any way i can overwrite the document if it already exists through move api?
here is my code
var rootSpaceName = companyhome.childByNamePath("nodename");
var childList = rootSpaceName.children;
var count = childList.length;
var test = new Array();
for(var i=0; i
{
var childName = childList.properties.name;
var child = childList;
if(!child.isContainer)
{
var newSpace = childName.substring(0,4);
var ind = 0;
var existingSpace = rootSpaceName.childByNamePath(newSpace);
child.move(existingSpace) // this code fails if the document with same name already exists in the space
}