I want to copy a folder into another, in Alfresco, recursively, with Java.
I only have the NodeRef of each folder.
How to do?
I want to copy a folder into another, in Alfresco, recursively, with Java.
I only have the NodeRef of each folder.
How to do?
Use CopyService.copyAndRename:
copyService.copyAndRename(
sourceNodeRef,
destinationNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "New name"),
true // Recursive
);
Inspired from Alfresco's own ScriptNode.java.
Just in case anybody is looking for copying file(s) from to destination folder in alfresco:
The last line sets the copied file name to actual document name; else you will find the copied file name as noderef of the file