public static void recursivelyDelete(String name){
  File curFile=new File(name);
  File subFile=null;
  int i=0;
  try {
    if (curFile.exists()) {
      if (curFile.isDirectory()) {
        String[] arrFiles=curFile.list();
        for (i=0; i < Array.getLength(arrFiles); ++i) {
          subFile=new File(curFile + File.separator + arrFiles[i]);
          recursivelyDelete(subFile.getCanonicalPath());
        }
      }
      if (!curFile.delete()) {
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

public static void recursivelyDelete ( String name ) { File curFile = new File ( name ) ; File subFile = null ; int i = 0 ; try { if ( curFile . exists ( ) ) { if ( curFile . isDirectory ( ) ) { String [ ] arrFiles = curFile . list ( ) ; for ( i = 0 ; i < Array . getLength ( arrFiles ) ; ++ i ) { subFile = new File ( curFile + File . separator + arrFiles [ i ] ) ; recursivelyDelete ( subFile . getCanonicalPath ( ) ) ; } } if ( ! curFile . delete ( ) ) { } } } catch ( Exception e ) { e . printStackTrace ( ) ; } }
deletes a file or directory and all of its contents .
