AssetManager copyAsset method to create version if destination already exist | Community
Skip to main content
New Participant
October 16, 2015
Solved

AssetManager copyAsset method to create version if destination already exist

  • October 16, 2015
  • 2 replies
  • 792 views

Hi,

How I can use copyAsset method to create new version of an asset if  destination asset already exist.

Thanks
LM

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

smacdonald2008
New Participant
October 16, 2015

Look at this community article:

https://helpx.adobe.com/experience-manager/using/graniteAPI.html

It talks about using the Granite version of AssetManager to move digital assets. Its up to your app logic to name the asset when you move it. For example:

 String assetPath = "/content/dam/testfolder/somefile.pdf";
 String copyPath = "/content/dam/testhtml/copieddoc.pdf";
 assetManager.copyAsset(assetPath, copyPath);

You can check to see if a asset has the name. If so - change the name of the new asset - ie - copieddoc1.pdf.

joerghoh
joerghohAccepted solution
Employee
October 16, 2015