Java Directory Clear cleanDirectory(File directory)

Here you can find the source of cleanDirectory(File directory)

Description

clean Directory

License

Open Source License

Declaration

public static void cleanDirectory(File directory) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    public static void cleanDirectory(File directory) {
        File[] files = directory.listFiles();
        if (files != null) {
            for (int i = 0; i < files.length; i++) {
                if (files[i].isDirectory()) {
                    cleanDirectory(files[i]);
                }/*from www.ja v a  2 s . co m*/
                files[i].delete();
            }
        }
    }
}

Related

  1. cleanDirectory(File dir)
  2. cleanDirectory(File dir)
  3. cleanDirectory(File dir, boolean deleteDirectory)
  4. cleanDirectory(File directory)
  5. cleanDirectory(File directory)
  6. cleanDirectory(File directory)
  7. cleanDirectory(File directory)
  8. cleanDirectory(File directory)
  9. cleanDirectory(File directory)