 <p>It looks to me as though you are having problems with understanding how to create a recursive operation for your folders. I'll try to give you an example of how I would handle this. Given my example may not be the best.</p> <pre><code>public static final String NAME = "Demo-Folder"; public static final String PARAM_ASPECT_NAME = "folder-name"; private NodeService nodeService; /** * Set the node service * * @param nodeService the node service */ public void setNodeService(NodeService nodeService) { this.nodeService = nodeService; } public void executeImpl(Action action, NodeRef actionUponNodeRef) { ChildAssociationRef childAssociationRef = nodeService.getPrimaryParent(actionUponNodeRef); System.out.println("****The folder is***** "+ childAssociationRef); iterateThroughChildren(childAssociationRef); } public void iterateThroughChildren(ChildAssociationRef childAssocRef) { System.out.println("****The folder is***** "+ childAssocRef); NodeRef childNodeRef = childAssocRef.getChildRef(); List&lt;ChildAssociationRef&gt; children = nodeService.getChildAssocs(childNodeRef); for (ChildAssociationRef childAssoc : children) { childAssoc.getChildRef(); // Use childNodeRef here. System.out.println("******Documents inside are******"+ childAssoc); // This call recurses the method with the new child. iterateThroughChildren(childAssoc); // If there are no children then the list will be empty and so this will be skipped. } } </code></pre> <p>I used your code above, and extended it out to include a new method called <code>iterateThroughChildren</code> which takes the <code>ChildAssociationRef</code> and gets the children and iterates through them. During the iteration the children are passed back into the method to allow for their children to be iterated, and so on until there are no children (meaning you are at the end of a branch). This allows you to iterate through an entire tree structure. </p>