Java File Path Delete deleteFile(String filePath)

Here you can find the source of deleteFile(String filePath)

Description

delete File

License

Apache License

Declaration

public static boolean deleteFile(String filePath) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    public static boolean deleteFile(String filePath) {
        File file = new File(filePath);
        if (!file.exists()) {
            return true;
        } else {//ww w .  j  a v a2 s  .c  o  m
            if (file.isFile()) {
                return file.delete();
            } else {
                for (File f : file.listFiles()) {
                    deleteFile(f.getAbsolutePath());
                }
                return file.delete();
            }
        }
    }
}

Related

  1. deleteFile(String filePath)
  2. deleteFile(String filePath)
  3. deleteFile(String filePath)
  4. deleteFile(String filePath)
  5. deleteFile(String filePath)
  6. deleteFile(String filePath)
  7. deleteFile(String filePath)
  8. deleteFile(String filePath)
  9. deleteFile(String filePath)