Here you can find the source of deleteDb(String path)
static public void deleteDb(String path)
//package com.java2s; /*//ww w .j a v a 2s . c o m Kvalobs - Free Quality Control Software for Meteorological Observations $Id: DbTestUtil.java,v 1.1.2.2 2007/09/27 09:02:20 paule Exp $ Copyright (C) 2007 met.no Contact information: Norwegian Meteorological Institute Box 43 Blindern 0313 OSLO NORWAY email: kvalobs-dev@met.no This file is part of KVALOBS KVALOBS is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. KVALOBS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with KVALOBS; if not, write to the Free Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ import java.io.File; public class Main { static public void deleteDb(String path) { File dbdir = new File(path); if (dbdir.exists()) { if (dbdir.isDirectory()) { String[] files = dbdir.list(); int dirs = 0; for (int i = 0; i < files.length; i++) { File f = new File(path + "/" + files[i]); if (f.isFile()) { f.delete(); } else { dirs++; } } if (dirs == 0) dbdir.delete(); } } } }