Java Delete Temp File deleteTempFiles(Map fileMap, String templateFileName)

Here you can find the source of deleteTempFiles(Map fileMap, String templateFileName)

Description

delete Temp Files

License

Open Source License

Declaration

private static void deleteTempFiles(Map<String, File> fileMap, String templateFileName) 

Method Source Code


//package com.java2s;
import java.io.File;

import java.util.Iterator;
import java.util.Map;

public class Main {
    private static void deleteTempFiles(Map<String, File> fileMap, String templateFileName) {
        boolean isSuccess = true;
        Iterator<File> fileIt = fileMap.values().iterator();
        while (fileIt.hasNext()) {
            File file = fileIt.next();
            isSuccess = file.delete();/*ww  w .j  av a 2 s .c  om*/
        }
        File file = new File(templateFileName);
        try {
            if (file.exists() && isSuccess) {
                isSuccess = file.delete();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }
}

Related

  1. deleteTempFiles()
  2. deleteTempFiles()
  3. deleteTempFiles()
  4. deleteTempFiles()
  5. deleteTempFiles(final File workFolder)