Java tutorial
//package com.java2s; /******************************************************************************* * Copyright 2015 GENBAND US LLC, All Rights Reserved * <p/> * This software embodies materials and concepts which are * proprietary to GENBAND and/or its licensors and is made * available to you for use solely in association with GENBAND * products or services which must be obtained under a separate * agreement between you and GENBAND or an authorized GENBAND * distributor or reseller. * <p/> * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER * AND/OR ITS LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THE WARRANTY AND LIMITATION OF LIABILITY CONTAINED IN THIS * AGREEMENT ARE FUNDAMENTAL PARTS OF THE BASIS OF GENBANDS BARGAIN * HEREUNDER, AND YOU ACKNOWLEDGE THAT GENBAND WOULD NOT BE ABLE TO * PROVIDE THE PRODUCT TO YOU ABSENT SUCH LIMITATIONS. IN THOSE * STATES AND JURISDICTIONS THAT DO NOT ALLOW CERTAIN LIMITATIONS OF * LIABILITY, GENBANDS LIABILITY SHALL BE LIMITED TO THE GREATEST * EXTENT PERMITTED UNDER APPLICABLE LAW. * <p/> * Restricted Rights legend: * Use, duplication, or disclosure by the U.S. Government is * subject to restrictions set forth in subdivision (c)(1) of * FAR 52.227-19 or in subdivision (c)(1)(ii) of DFAR 252.227-7013. *******************************************************************************/ import java.io.*; public class Main { public static void clearDirectory(File dir) { String[] list = dir.list(); if (list != null) { for (int i = 0; i < list.length; i++) { File file = new File(dir, list[i]); file.delete(); } } } }