Java File Path Delete deleteFilesInDirectory(File path)

Here you can find the source of deleteFilesInDirectory(File path)

Description

delete Files In Directory

License

Open Source License

Declaration

public static void deleteFilesInDirectory(File path) 

Method Source Code


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

import java.io.File;

public class Main {
    public static void deleteFilesInDirectory(File path) {
        if (path.exists()) {
            File[] files = path.listFiles();
            for (int i = 0; i < files.length; i++) {
                if (!files[i].isDirectory()) {
                    files[i].delete();//from   w w  w.  j a v a 2s . c  om
                }
            }
        }
    }
}

Related

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