title: How to Copy AEM node one place to another location?
body: <p>I need to copy an AEM JCR node source to destination. The following code is working but if that node already exists in the destination I'm getting an error:</p>
  
  <pre><code>String sourcePath="/content/dam/assets/content";
  String destinationPath="/content/dam/Marketing/content";
  Session session = resourceResolver.adaptTo(Session.class);
  Workspace workspace = session.getWorkspace();
  workspace.copy(sourcePath, destinationPath);
  session.logout();
  </code></pre>
  
  <p>But the problem is that the content node already exists inside the folder "Marketing" so that it's only working on the first time. Once the content node is created I'm not able to copy/update the node but I need to replace each time without deleting the source node.</p>