-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearch.java
More file actions
27 lines (25 loc) · 824 Bytes
/
Search.java
File metadata and controls
27 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Писал на макбуке, по этому такие пути
import java.io.*;
public class Search {
public static void showInfo(String dir, String r){
File f = new File(dir);
if(f.exists()){
if(f.isFile()){
if(f.getPath().contains("." + r)){
System.out.println(f.length() + " " + f.getPath());
}
}else if(f.isDirectory()){
String[] s = f.list();
for(int i = 0;i < f.list().length;i++){
String s2 = f.getPath()+ "/" + s[i];
showInfo(s2, r);
}
}
}else{
System.out.println("Directory not found");
}
}
public static void main(String[] args) {
showInfo("/w", "php");
}
}