alfrescomovefile

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

  • 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/