Java File Path Delete deleteFileSystemDirectory(String dirPath)

Here you can find the source of deleteFileSystemDirectory(String dirPath)

Description

delete File System Directory

License

Open Source License

Declaration

public static void deleteFileSystemDirectory(String dirPath) 

Method Source Code


//package com.java2s;
// Released under the terms of the GNU General Public License version 2 or later.

import java.io.*;

public class Main {
    public static void deleteFileSystemDirectory(String dirPath) {
        deleteFileSystemDirectory(new File(dirPath));
    }//from w  w w.j a  v a2  s  .  c o m

    public static void deleteFileSystemDirectory(File current) {
        File[] files = current.listFiles();

        for (int i = 0; files != null && i < files.length; i++) {
            File file = files[i];
            if (file.isDirectory())
                deleteFileSystemDirectory(file);
            else
                file.delete();
        }
        current.delete();
    }
}

Related

  1. deleteFilesInDirectory(File path)
  2. deleteFilesInDirectory(String pathname)
  3. deleteFilesinPath(File pBaseDir, String pFileName)
  4. deleteFilesRecursive(final File path)
  5. deleteFileSystemDirectory(String dirPath)
  6. deleteFileWithoutException(final String path)
  7. deleteFileWithSuffix(String path, String suffix)
  8. deleteFolder(File path)
  9. deleteFolder(File path)