I need to extract all the multi-part ZIP and RAR archives in a given path? Does Java have any inbuilt methods for doing this? If not, would someone happen to know of a free library that does this?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Loop all files in the directory –
new File(dir).listFiles(), possibly using aFilenameFilterto retain only those whose extension is .zipYou can use the
java.util.zippackage, or commons-compress. But my experience shows that using the ant Zip task programatically is way easier. (You’d need the ant jar on the classpath). This is for .zip files. For RAR you’d need another utility. Take a look at this question. The URL in the answer does not open, but the name of the project is valid – google it.