public static boolean dirDelete(String path)
    {
	if(isPathValid(path))
	{
	    if(dirExist(path))
	    {
		File dir = new File(path);

		// Deletes all files and sub directories under the directory.
		// Returns true if all deletions were successful.
		// If a deletion fails, the method stops attempting to delete and returns false.
		if (dir.isDirectory()) 
		{
		    String[] children = dir.list();

		    for (int i=0; i < children.length; i++) 
		    {
			boolean success = deleteDir(new File(dir, children[i]));
			if (!success) { return false; }
		    }
		}

		// The directory is now empty so delete it
		return dir.delete();
	    }
	    else{ return true; }
	}
	else
	    return false;
    }