copy folder with all its content to destination node

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Established Member

copy folder with all its content to destination node

Jump to solution

var docNodeId = <argument from api>

var docNode = search.findNode("workspace://SpaceStore/"+docNodeId);

.....

docNode.copy(objDestNode);

This code works if  <argument from api> is node id of a file

.

This code doesn't work if  <argument from api> is node id of a folder. It just creates an empty folder with the same name as that of  <argument from api>

How do I copy a folder with all its content to a destination node?

1 Solution

Accepted Solutions
Highlighted
Established Member II

Re: copy folder with all its content to destination node

Jump to solution

You can try deep copy.

copy(destination, deepCopy)

pass true in second parameter.

View solution in original post

2 Replies
Highlighted
Established Member II

Re: copy folder with all its content to destination node

Jump to solution

You can try deep copy.

copy(destination, deepCopy)

pass true in second parameter.

View solution in original post

Highlighted
Senior Member II

Re: copy folder with all its content to destination node

Jump to solution

...But be careful. I think the copy will be excuted in a single transaction - so you will be creating large transaction when copying a big folder structure and such transactions are not good for Solr performance. You could use a tool like batch-executer to split this up in smaller parts.