Here you can find the source of deleteFolder(final String folder)
Parameter | Description |
---|---|
folder | the folder |
public static void deleteFolder(final String folder)
//package com.java2s; /*// w ww . j av a 2 s . c o m * FileUtil.java * Copyright (c) 2014, CODEROAD, All Rights Reserved. * * This software is the confidential and proprietary information of CODEROAD * ("Confidential Information"). You shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement you entered into with * CODEROAD. */ import java.io.File; public class Main { /** * Delete folder. * * @param folder the folder */ public static void deleteFolder(final String folder) { File folderPath = new File(folder); try { final File[] filesList = folderPath.listFiles(); for (final File file : filesList) { file.delete(); } folderPath.delete(); } catch (Exception e) { e.printStackTrace(); } } }