Advertisement
Josif_tepe

Untitled

Mar 27th, 2021
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1.     import java.io.*;
  2.  
  3.     public class Main {
  4.  
  5.         public static void main(String[] args) {
  6.                 File f = new File("/Users/josiftepegjozov/Documents/test");
  7.                 File[] files = f.listFiles();
  8.                 for(int i = 0; i < files.length; i++) {
  9.                     if(files[i].toString().endsWith("rtf")) {
  10.                         if(files[i].delete()) {
  11.                             System.out.println("sucess");
  12.                         }
  13.                         else {
  14.                             System.out.println("fail");
  15.                         }
  16.                     }
  17.                 }
  18.             }
  19.  
  20.         }
  21.  
  22.     // rec(folder: test)
  23.     // rec(folder: test2)
  24.     // rec(folder: test3)
  25.     //
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement