String fulldate = year + "-" + month + "-" + day + "-" + min; File dateFolder = new File("F:\\" + compname + "\\" + fulldate); dateFolder.mkdir(); String zipName = "F:\\" + compname + "\\" + fulldate + "\\" + fulldate + ".zip"; zipFolder(tobackup, zipName);
La funcion que crea el ZIP:
public static void zipFolder(File folder, String name) throws Exception { byte[] buffer = new byte[18024]; ZipOutputStream out = new ZipOutputStream(new FileOutputStream(name)); FileInputStream in = new FileInputStream(folder); out.putNextEntry(new ZipEntry(name)); int len; while((len = in.read(buffer)) > 0) { out.write(buffer, 0, len); } out.closeEntry(); in.close(); out.close(); }
Alguna idea que puedo estar haciendo mal?