public static void deleteDirectory(final File directory){
  final File[] filesInTestDir=directory.listFiles();
  if (filesInTestDir != null) {
    for (    final File eachFile : filesInTestDir) {
      eachFile.delete();
    }
  }
  directory.delete();
}

public static void deleteDirectory ( final File directory ) { final File [ ] filesInTestDir = directory . listFiles ( ) ; if ( filesInTestDir != null ) { for ( final File eachFile : filesInTestDir ) { eachFile . delete ( ) ; } } directory . delete ( ) ; }
deletes directory ' s content and then deletes directory itself . deleting is not recursive .
