-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetallfile.java
More file actions
33 lines (31 loc) · 843 Bytes
/
Copy pathgetallfile.java
File metadata and controls
33 lines (31 loc) · 843 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
28
29
30
31
32
33
package use;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
public class getallfile {
public static void main(String[] args) {
File file = new File("E:\\root");
System.out.println(print(file));
}
public static long print(File f){
long a=0;
if(f!=null){
if(f.isDirectory()){
File[] fileArray=f.listFiles();
if(fileArray!=null){
for (int i = 0; i < fileArray.length; i++) {
//递归调用
print(fileArray[i]);
}
}
}
else{
if(f.length() > a){
a = f.length();
}
System.out.println(f+"aaaaaaa"+a);
}
}
return a;
}
}