Java File Path Delete deleteFilesRecursive(final File path)

Here you can find the source of deleteFilesRecursive(final File path)

Description

Deletes files recursively.

License

Open Source License

Parameter

Parameter Description
path the file or directory to delete.

Declaration

public static void deleteFilesRecursive(final File path) 

Method Source Code


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

public class Main {
    /**/*w  ww. j  a  v  a 2  s  . co  m*/
     * <p>Deletes files recursively.</p>
     *
     * @param path the file or directory to delete.
     */
    public static void deleteFilesRecursive(final File path) {
        if (path.isDirectory()) {
            final File[] files = path.listFiles();
            for (File file : files)
                deleteFilesRecursive(file);
        }
        path.delete();
    }
}

Related

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