-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
45 lines (26 loc) · 973 Bytes
/
Test.java
File metadata and controls
45 lines (26 loc) · 973 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
34
35
36
37
38
39
40
41
42
43
44
import java.io.*;
import java.util.regex.Pattern;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class Test {
public static void main(String[] args){
getFileListName("D:\\");
}
public static void getFileListName(String strPath) {
File dir = new File(strPath);
File[] files = dir.listFiles();
if (files != null) {
for (int i = 0; i < files.length; i++) {
String content = files[i].getName();
String pattern = ".*陈瀚洋.*";
boolean isMatch = Pattern.matches(pattern, content);
if (isMatch) {
System.out.println(files[i].getName());
}
if (files[i].isDirectory()) {
getFileListName(files[i].getAbsolutePath());
//System.out.println(files[i].getAbsolutePath() + files[i].getName());
}
}
}
}
}