Delete contents from an uploaded package

I was wondering if it is possible to upload a zip file in UI, and when the document is uploaded I want it to search the ZIP file folders and delete some subfolders if they are found. For example: 

Pacakge1.zip >> content >> folder1, folder2, folder3, xml file, xml file etc.. 

I want it to go into the subfolder "content" and see if there are folders in there, if so it will delete them. In this case, it will delete folder1, folder2, folder3 and leave anything else. 

  Discussion posts and replies are publicly visible