Java Delete Temp Directory deleteTemporaryDirectory(String dir)

Here you can find the source of deleteTemporaryDirectory(String dir)

Description

delete Temporary Directory

License

Open Source License

Declaration

public static void deleteTemporaryDirectory(String dir) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {
    public static void deleteTemporaryDirectory(String dir) {
        File tmpDir = new File(dir);
        for (File f : tmpDir.listFiles()) {
            f.delete();//from   ww w . j  a  va 2 s .c  o  m
        }
        tmpDir.delete();

        File tmpParentDir = tmpDir.getParentFile();
        if (tmpParentDir.isDirectory() && tmpParentDir.getName().equals("tmp")) {
            tmpParentDir.delete();
        }
    }
}

Related

  1. deleteTempDir()
  2. deleteTempDir(File file)
  3. deleteTempDirectories(List lstTempDirectories)
  4. deleteTempDirectory(File dir)
  5. deleteTempMapset(String mapsetFolder)
  6. deleteTestData()
  7. deleteTestDir(final File file)
  8. deleteTestDirectory(File testDir)
  9. deleteTestFile(String fileName)