public static boolean deleteDirectory( File dir ) {
        if( dir.isDirectory() ) {
            String[] children = dir.list();
            for( int i = 0; i < children.length; i++ ) {
                if( children[ i ] == "." || children[ i ] == ".." )
                    continue;
                boolean ok = deleteDirectory( new File( dir, children[ i ] ) );
                if( !ok )
                    return( false );
            }
        }

        return( dir.delete() );
    }