Here you can find the source of delete(File file)
Parameter | Description |
---|---|
file | the file/folder to be deleted |
static void delete(File file)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { /**/*from w w w . ja v a2s .co m*/ * Delete a file or folder including contained files or folders. * * @param file the file/folder to be deleted */ static void delete(File file) { if (file.isFile()) { file.delete(); } else if (file.isDirectory()) { File[] contained = file.listFiles(); for (int f = 0; f < contained.length; f++) { delete(contained[f]); } file.delete(); } } }