private static void deleteFilesByDirectory(File directory){
  if (directory != null && directory.exists() && directory.isDirectory())   for (  File item : directory.listFiles())   item.delete();
}

private static void deleteFilesByDirectory ( File directory ) { if ( directory != null && directory . exists ( ) && directory . isDirectory ( ) ) for ( File item : directory . listFiles ( ) ) item . delete ( ) ; }
delete all files in given directory
