Java File Path Delete deleteAllFiles(String folder, String type)

Here you can find the source of deleteAllFiles(String folder, String type)

Description

delete All Files

License

Open Source License

Declaration

public static void deleteAllFiles(String folder, String type) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    public static void deleteAllFiles(String folder, String type) {
        File src = new File(folder);
        String[] files = src.list();
        for (String f : files) {
            if (new File(folder + File.separator + f).isDirectory()) {
                deleteAllFiles(folder + File.separator + f, type);
            } else if (f.endsWith(type)) {
                new File(folder + File.separator + f).delete();
            }/* w  w w  . ja  va 2 s .c o  m*/
        }

    }
}

Related

  1. deleteAllFiles(File dir)
  2. deleteAllFiles(File directory)
  3. deleteAllFiles(File directory)
  4. deleteAllFiles(File dirOrFile)
  5. deleteAllFiles(String directory)
  6. deleteAllFiles(Vector filesToDelete)
  7. deleteAllFilesAux(String input, File swapFolder)
  8. deleteAllFilesIn(String dir)
  9. deleteAllFilesInDir(File dir)