Manually modifying the package and re-uploading | Community
Skip to main content
November 28, 2017
Solved

Manually modifying the package and re-uploading

  • November 28, 2017
  • 5 replies
  • 6686 views

Hi all,

I have a requirement where I have to download a dam package, extract it and add more images through windows explorer, re-zip it and upload the package again. However, AEM rejects any package which is compressed manually saying 'missing JCR_ROOT'. Even if i dont change any content, AEM still rejects packages which are zipped manually. Is there any workaround for it? Our use-case is to have the author add more images in the folders, re-zip it and upload again, as this reduces authoring time.

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 chun-pin

Make sure when you Extract the zip file, the configuration is NOT creating folder for the extracted file. 
Otherwise, when you compress the file back into a zip file again, the folder structure will be different than the original one.

5 replies

Ravi_Pampana
Community Advisor
Community Advisor
November 28, 2017
kautuk_sahni
Community Manager
Community Manager
February 26, 2021
@ravi_pampana thank you for providing solution to the community.
Kautuk Sahni
vitis90Author
November 28, 2017

Thanks for sending the link. But the command jar -cvfm <<new-package-name>.zip  META-INF/   jcr_root/ is not working unfortunatelty.

Getting this message

jar -cvfm racha.zip  META-INF/   jcr_root/

java.io.FileNotFoundException: META-INF (Access is denied)

        at java.io.FileInputStream.open0(Native Method)

VeenaVikraman
Community Advisor
Community Advisor
November 28, 2017

Hi Vitis

     How are you planning to copy the DAM content ? Every DAM asset will have below structure when extracted. Do you have another DAM zip which you are trying to copy to this one ?

If so , Please do the following

1. Right click your zip file and click "Extract here ". (Do not extract to a folder)

2. Once you get these folders , add/modify your content to the corresponding folder

3. Select the jcr_root and META-INF folder and right click and "Add to Zip file" .

(I use WinSCP for this and it works fine). Give the name of the package . If you want to change the name of the package to be uploaded just change the name in the properties.xml file inside META-INF --> Vault

Please make sure that if you are adding DAM assets you do it the right way. The content structure for the DAM assets should be followed properly else you will end up in corrupted packages. I will not recommend to do this way unless for a small fix or tweak .

November 28, 2017

Use 7-Zip to add to the archive.  It has been my experience with other 'jar' archives that Windows or other 'zip' technologies can change the file signatures.  7-Zip has always allowed me to add things without breaking the archive.  Please post your result if you use 7-zip.

By the way, if you repackage with 'jar' and use '-cvMf', you must use a capital 'M' to preserve existing META-INF.  The small 'm' means something else....

chun-pin
chun-pinAccepted solution
February 10, 2021

Make sure when you Extract the zip file, the configuration is NOT creating folder for the extracted file. 
Otherwise, when you compress the file back into a zip file again, the folder structure will be different than the original one.

kautuk_sahni
Community Manager
Community Manager
February 26, 2021
@chun-pin thank you for sharing answer with community.
Kautuk Sahni
chun-pin
November 2, 2021

@kautuk_sahniAnytime! 😁