Java File Path Delete deleteFiles(final File pathname)

Here you can find the source of deleteFiles(final File pathname)

Description

Description goes here.

License

Open Source License

Parameter

Parameter Description
directory a parameter

Declaration

protected static void deleteFiles(final File pathname) 

Method Source Code


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

import java.io.File;

public class Main {
    /**/*from   ww  w. j  ava 2 s  .co m*/
     * Description goes here.
     *
     * @param directory
     */
    protected static void deleteFiles(final File pathname) {
        if (pathname.isDirectory()) {
            for (File file : pathname.listFiles()) {
                if (file.isFile()) {
                    file.delete();
                } else if (file.isDirectory() && !".".equals(file.getName()) && !"..".equals(file.getName())) {
                    deleteFiles(file);
                }
            }
            pathname.delete();
        }
    }
}

Related

  1. DeleteFileFolder(String path)
  2. deleteFileFromDisk(String name, String path)
  3. deleteFileIfExists(String path)
  4. deleteFileOrDirectory(String path)
  5. deleteFileOrDirectory(String path)
  6. deleteFiles(String actionPath, String filePath)
  7. deleteFiles(String filePath)
  8. deleteFilesInDirectory(File path)
  9. deleteFilesInDirectory(String pathname)