Java File Path Delete deleteBlankPath(String path)

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

Description

delete Blank Path

License

Apache License

Declaration

public static int deleteBlankPath(String path) 

Method Source Code

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

import java.io.File;

public class Main {

    public static int deleteBlankPath(String path) {
        File f = new File(path);
        if (!f.canWrite()) {
            return 1;
        }/*from ww  w  . j  ava  2s.  c  om*/
        if (f.list() != null && f.list().length > 0) {
            return 2;
        }
        if (f.delete()) {
            return 0;
        }
        return 3;
    }
}

Related

  1. deleteAllFilesInDir(File dir)
  2. deleteAllFilesInDirectory(String path)
  3. deleteAllFilesOnlyInDirectory(File startingDir)
  4. deleteAllFilesRecursively(String directoryName)
  5. deleteAndCreateFolder(String path)
  6. deleteChildDirectoriesExcept(File path, String... directoriesToSkip)
  7. deleteContents(File dirPath, List failures)
  8. deleteContentsOnly(final String srcPath)
  9. deleteDataFiles(final Collection paths)