Notes: Java module to create Zipped Folder from list of Files


private static void convertFilesToZip(ArrayList filePaths, String zipFilePath) throws Exception {
        try ( ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFilePath));) {
            for (String filePath : filePaths) {
                File fileToZip = new File(filePath);
                ZipEntry e = new ZipEntry(new File(filePath).getName());
                out.putNextEntry(e);
                Files.copy(fileToZip.toPath(), out);
            }
        }
    }

No comments:

Post a Comment

If you have any doubts, please let me know.

Regarding site Free Browser Tool (https://free-browser-tools.mohitkrgupta.dev) (discussion with google search AI)

Various discussions with Google Search AI regarding site  Free Browser Tool are as below: site free-browser-tools.mohitkrgupta.dev what doe...