Java Delete Empty Directory deleteEmptyFiles(String p)

Here you can find the source of deleteEmptyFiles(String p)

Description

delete Empty Files

License

Apache License

Declaration

public static void deleteEmptyFiles(String p) 

Method Source Code

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

import java.io.File;

public class Main {
    public static void deleteEmptyFiles(String p) {
        File path = new File(p);

        File[] files = path.listFiles();
        for (int i = 0; i < files.length; i++) {
            if (files[i].length() == 0) {
                files[i].delete();/*w  ww  .  jav  a 2  s. co  m*/
            }
        }
    }
}

Related

  1. deleteEmptyDirectory(File fileOrDirectory)
  2. deleteEmptyDirectoryRecursive(File directory)
  3. deleteEmptyDirectoryRecursive(File directory)
  4. deleteEmptyDirs(File dir)
  5. deleteEmptyDirs(File dir)
  6. deleteEmptyFolders(java.io.File file)
  7. deleteEmptyFolders(String[] args)
  8. deleteEmptyParentFolders(File leafFolder)
  9. deleteEmptyParents(File currentParentFile, String inputDir)