-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetFoldFileNames.java
More file actions
33 lines (29 loc) · 837 Bytes
/
GetFoldFileNames.java
File metadata and controls
33 lines (29 loc) · 837 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
import java.io.File;
import java.util.ArrayList;
public class GetFoldFileNames {
/**
*
* @author zdz8207
*/
public static void main(String[] args) {
getFileName("d:\\music");
}
public static String getFileName(String path) {
ArrayList fileList = new ArrayList();
File f = new File(path);
if (!f.exists()) {
System.out.println(path + " not exists");
}
File fa[] = f.listFiles();
for (int i = 0; i < fa.length; i++) {
File fs = fa[i];
if (fs.isDirectory()) {
System.out.println(fs.getName() + " [Ŀ¼]");
} else {
fileList.add("\""+fs.getName()+"\"");
System.out.println(fs.getName());
}
}
return fileList.toString();
}
}