Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

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

Avatar

Level 1

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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-zipinput...

View solution in original post

3 Replies

Avatar

Level 1

Thanks for the reply.working on it.

Avatar

Correct answer by
Level 10

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-zipinput...

Avatar

Level 1

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.