Java Delete Directory deleteFiles(File docFolder)

Here you can find the source of deleteFiles(File docFolder)

Description

ftang Comment method "deleteFiles".

License

Open Source License

Parameter

Parameter Description
docFolder a parameter

Declaration

private static void deleteFiles(File docFolder) 

Method Source Code


//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

import java.io.File;

public class Main {
    /**/*w w  w. j  a  va 2 s.  c o m*/
     * ftang Comment method "deleteFiles".
     * 
     * @param docFolder
     */
    private static void deleteFiles(File docFolder) {
        if (docFolder.listFiles() == null || docFolder.listFiles().length == 0) {
            docFolder.delete();
        } else {
            for (File file : docFolder.listFiles()) {
                if (file.isFile()) {
                    file.delete();
                } else if (file.isDirectory()) {
                    deleteFiles(file);
                }
            }
        }

    }
}

Related

  1. deleteFiles(File dir)
  2. deleteFiles(File directory)
  3. deleteFiles(File directory)
  4. deleteFiles(File directory)
  5. deleteFiles(File directory, String prefix)
  6. deleteFiles(File f, boolean del_self)
  7. deleteFiles(File file)
  8. deleteFiles(File folder)
  9. deleteFiles(File folder)