cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED]javascript to move content from folder to another?

targa2000
Champ in-the-making
Champ in-the-making
I have a document in folder A and when I run the script I want the document to move to another folder B.  both folders A and B are in the same folder C.  How would I do this?
3 REPLIES 3

zaizi
Champ in-the-making
Champ in-the-making
Start with the wiki: http://wiki.alfresco.com/wiki/3.2_JavaScript_API, http://wiki.alfresco.com/wiki/JavaScript_API_Cookbook.

Check the example scripts available in the Alfresco.

targa2000
Champ in-the-making
Champ in-the-making
thanks for the links!  I will use :

var dest = companyhome.childByNamePath("Sites/testone/documentLibrary/TEST/Project/Folder");
document.move(dest);

I had another error and it caused me to wonder if I was using the move() correctly.

chandu7ee
Champ in-the-making
Champ in-the-making
Just try this code once., may it will help you.

var sourceFolder = companyhome.childByNamePath("SourceFolder");
var destinFolder = companyhome.childByNamePath("DestinationFolder");


if(sourceFolder != null)
{
var i=0;
sourceChildren = sourceFolder.children;
   for(i=0; i<sourceChildren.length;i++)
   {
   child = sourceChildren;
   child.move(destinFolder);
   }
}

Thanks.
Chandu