'Script to Move Files in Alfresco

In Alfresco users can use rules to move files. How do I programmatically move a file from one folder to another?

Do you have an example?

I am using Alfresco 7.0 Share/Community version



Solution 1:[1]

Using Script :

var backupFolder = space.childByNamePath('testfolder');
if (backupFolder == null)
{
   backupFolder = space.createFolder('testfolder');
}

document.move(backupFolder );

Ref : https://hub.alfresco.com/t5/alfresco-content-services-hub/javascript-api-cookbook/ba-p/293260

https://docs.alfresco.com/content-services/6.1/develop/reference/repo-root-objects-ref/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1