开发者

How can I extract all multi-part ZIP/RAR archives in a directory?

开发者 https://www.devze.com 2023-01-27 03:06 出处:网络
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?

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?

Than开发者_JAVA百科ks.


  1. Loop all files in the directory - new File(dir).listFiles(), possibly using a FilenameFilter to retain only those whose extension is .zip

  2. You can use the java.util.zip package, 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消