Java File Path Delete delFile(String path)

Here you can find the source of delFile(String path)

Description

del File

License

Open Source License

Declaration

public static void delFile(String path) 

Method Source Code


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

import java.io.File;

public class Main {
    public static void delFile(String path) {
        File file = new File(path);
        if (file.exists() && file.isFile()) {
            file.delete();/*from   w ww .  j a  v a2s  .  co  m*/
        } else if (file.exists() && file.isDirectory()) {
            File[] files = file.listFiles();
            if (files != null) {
                for (File f : files) {
                    if (f != null) {
                        delFile(f.getAbsolutePath());
                    }
                }
            }
        }
    }
}

Related

  1. delFile(String filePathAndName)
  2. delFile(String filePathAndName)
  3. delFile(String filePathAndName)
  4. delFile(String filePathAndName)
  5. DelFile(String in_Path, ArrayList arrFileList)
  6. delFile(String pathName)
  7. delFileIfExists(String path)
  8. delFiles(String path)
  9. delTree(String path)