retrieve files from content/dam/migration/econtent1-zip1,zip1,..,zip1 | Community
Skip to main content
New Participant
October 16, 2015
Solved

retrieve files from content/dam/migration/econtent1-zip1,zip1,..,zip1

  • October 16, 2015
  • 3 replies
  • 1405 views

I am new to AEM.I have zip files- which contains xml and pdf stored under content/dam/eContent1-CAM-1234.zip,...,...  I need to write a code in my bundle that retrieves all the zip folder under econtent1 one after other...extract the zip folder which has one xml and pdf file...please help me how to easily iterate them or query them.I have attached the crxde screen shot of the nodes.

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

Hi Srivarsha,

Retrieve the zip file using resourceResolver if you already know the path 

ex : 

          Resource resource = resourceResolver.getResource(path);

          Asset asset=resource.adaptTo(Asset.class);

 

Then acess the zip file using ZipEntry Api (Java)

ex:

http://www.thecoderscorner.com/team-blog/java-and-jvm/12-reading-a-zip-file-from-java-using-zipinputstream

3 replies

New Participant
October 16, 2015

Thanks for the reply.working on it.

Lokesh_Shivalingaiah
Lokesh_ShivalingaiahAccepted solution
New Participant
October 16, 2015

Hi Srivarsha,

Retrieve the zip file using resourceResolver if you already know the path 

ex : 

          Resource resource = resourceResolver.getResource(path);

          Asset asset=resource.adaptTo(Asset.class);

 

Then acess the zip file using ZipEntry Api (Java)

ex:

http://www.thecoderscorner.com/team-blog/java-and-jvm/12-reading-a-zip-file-from-java-using-zipinputstream

New Participant
October 16, 2015

Hi for migration project . I extracted the zip files in content/dam/dcl/migration now I need to move the extracted  files  in jcr-content add metadata using xml file, create versions, etc..

I am having difficult time traversing the jcr:content. to accomplish the move this is  a gatekeeper class in my workflow launcher.

resource - is dam/dcl/migration..i have attached the screen shot of the node structure i need to traverse.

Please help me this is an urgent issue that needs to be fixed.