Advertisement
Josif_tepe

Untitled

Mar 25th, 2021
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import javax.annotation.processing.SupportedSourceVersion;
  2. import java.io.*;
  3. import java.util.logging.Filter;
  4.  
  5. public class Main {
  6.     static void rec(File f) {
  7.         File[] files = f.listFiles();
  8.         for(int i = 0; i < files.length; i++) {
  9.             if(files[i].isDirectory()) {
  10.                 rec(files[i]);
  11.             }
  12.             else {
  13.                 if(files[i].toString().endsWith(".txt") || files[i].toString().endsWith(".out")) {
  14.                     long kb = files[i].length();
  15.                     kb /= 1024;
  16.                     if (kb >= 1 && kb <= 100) {
  17.                         System.out.println(files[i].getName());
  18.                     }
  19.                 }
  20.             }
  21.         }
  22.     }
  23.     public static void main(String[] args){
  24.         String filePath = args[0];
  25.         File f = new File(filePath);
  26.         rec(f);
  27.  
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement