Java File Path Delete delDir(String path)

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

Description

del Dir

License

Open Source License

Parameter

Parameter Description
path a parameter

Declaration

public static synchronized void delDir(String path) 

Method Source Code


//package com.java2s;
import java.io.*;

public class Main {
    /**/* w  w  w. j a v a  2s .  c  o m*/
     * @param path
     */
    public static synchronized void delDir(String path) {
        File dir = new File(path);
        if (dir.exists()) {
            dir.delete();
        }
    }

    /**
     * file delete method
     *
     * @param file
     */
    public static void delete(File file) {
        if (file != null) {
            if (file.exists()) {
                file.delete();
            }
        }
    }
}

Related

  1. delAll(String path)
  2. delAllFile(String path)
  3. delAllFiles(File dir, String prefix)
  4. delAllFiles(File dir, String suffix)
  5. delDirAndFile(String tempath)
  6. deleleFiles(String regex, String path)
  7. delEmptyPath(String path)
  8. delete(File path)