/**
* @param _sPath 压缩文件夹
*/
public static void compress(String _sPath) {
logger.info("Compress The Path:" + _sPath);
String sBasePath = "d:/FixPackage/";
String sInDir = sBasePath + _sPath;
String sOutDir = sBasePath + _sPath + ".zip";
// System.out.println("sInDir:"+sInDir);
// System.out.println("sOutDir:"+sOutDir);
File oSrcDir = new File(sInDir);
if (!oSrcDir.exists()) {
throw new RuntimeException(oSrcDir + "不存在");
}
Project prj = new Project();
Zip zip = new Zip();
zip.setProject(prj);
File sOut = new File(sOutDir);
zip.setDestFile(sOut);
FileSet oSet = new FileSet();
oSet.setProject(prj);
File oIn = new File(sInDir);
oSet.setDir(oIn);
zip.addFileset(oSet);
zip.execute();
}
使用ant 压缩文件
最新推荐文章于 2023-08-13 21:00:13 发布