Using this program all the files with the particular extension(.txt) can be deleted at once through java program.

Java Code:
import java.io.File;
 import java.io.FilenameFilter;
 import java.lang.*;
 public class delfile {
   public static void main (String args[]) {
     System.out.println("Deleted Files ");
     delfile d = new delfile();
     d.deleteFilesofParticularExtension("c:/javaTips/", ".txt");
    }

   public void deleteFilesofParticularExtension( String d, String e ) {
     FilterExtension filter = new FilterExtension(e);
     File f = new File(d);

     String[] list = f.list(filter);
     File f2;
     if (list.length == 0) return;

     for (int i = 0; i < list.length; i++) {
       f2 = new File(d + list[i]);
       boolean isdeleted =   f2.delete();
       System.out.print(f2);
       System.out.println( "  deleted " + isdeleted);
       }
     }

   class FilterExtension implements FilenameFilter {
     private String ext;
     public FilterExtension( String ext ) {
       this.ext = ext;             
       }
     public boolean accept(File dir, String name) {
       return (name.endsWith(ext));
       }
     }
  }