Java Folder Delete clearDir(File dir)

Here you can find the source of clearDir(File dir)

Description

clear Dir

License

Open Source License

Declaration

private static void clearDir(File dir) 

Method Source Code

//package com.java2s;
/*/*from   ww  w .j  a  v a 2s.  c o m*/
 * Copyright (C) 2016 Sebastian Hjelm
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version.
 */

import java.io.File;

public class Main {
    private static void clearDir(File dir) {
        for (File f : dir.listFiles()) {
            if (f.isDirectory()) {
                clearDir(f);
            }
            f.delete();
        }
    }
}

Related

  1. clearDir(File d)
  2. clearDir(File dir)
  3. clearDir(File dir)
  4. clearDir(File dir)
  5. clearFiles(File dir)
  6. clearFilesOnPath(String path)