All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.osmdroid.mtp.util.FolderDeleter Maven / Gradle / Ivy

There is a newer version: 5.2
Show newest version
// Created by plusminus on 2:27:27 AM - Mar 6, 2009
package org.osmdroid.mtp.util;

import java.io.File;

public class FolderDeleter {
	// ===========================================================
	// Constants
	// ===========================================================

	// ===========================================================
	// Fields
	// ===========================================================

	// ===========================================================
	// Constructors
	// ===========================================================

	// ===========================================================
	// Getter & Setter
	// ===========================================================

	// ===========================================================
	// Methods from SuperClass/Interfaces
	// ===========================================================

	// ===========================================================
	// Methods
	// ===========================================================

	/**
	 * @return true on success, false otherwise.
	 */
	public static boolean deleteFolder(final File pFolder){
		final File[] children = pFolder.listFiles();

		for(final File c : children){
			if(c.isDirectory()){
				if(!deleteFolder(c)){
					System.err.println("Could not delete " + c.getAbsolutePath());
					return false;
				}
			}else{
				if(!c.delete()){
					System.err.println("Could not delete " + c.getAbsolutePath());
					return false;
				}
			}
		}
		return pFolder.delete();
	}

	// ===========================================================
	// Inner and Anonymous Classes
	// ===========================================================
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy