public static boolean deleteFiles(final File targetDir){
  if (targetDir == null || !targetDir.isDirectory()) {
    Log.e(FileUtils.class,"deleteFiles(): Null parameter given or not a Directory");
    return false;
  }
  boolean isDeleted=true;
  final File[] filesList=targetDir.listFiles();
  for (  File file2Delete : filesList)   if (file2Delete.isFile())   isDeleted&=file2Delete.delete();
  return isDeleted;
}

public static boolean deleteFiles ( final File targetDir ) { if ( targetDir == null || ! targetDir . isDirectory ( ) ) { Log . e ( FileUtils . class , "deleteFiles(): Null parameter given or not a Directory" ) ; return false ; } boolean isDeleted = true ; final File [ ] filesList = targetDir . listFiles ( ) ; for ( File file2Delete : filesList ) if ( file2Delete . isFile ( ) ) isDeleted &= file2Delete . delete ( ) ; return isDeleted ; }
method deletes all files only ( but not subdirectories ) from given directory . returns true if all files deleted false if at least one doesn ' t
