Here you can find the source of emptyDirectory(File dir)
Parameter | Description |
---|---|
dir | a parameter |
public static void emptyDirectory(File dir)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**//w ww. j a v a 2s . c o m * @param dir */ public static void emptyDirectory(File dir) { if (dir.exists() && dir.isDirectory()) { File[] tmpFiles = dir.listFiles(); if (tmpFiles.length > 0) { for (File f : tmpFiles) { f.delete(); } } } } }