推荐于2016-04-22 20:54:16
最佳答案
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
|
import
java.io.File;
public
class
$ {
public
static
void
main(String[] args) {
String path =
"D:/"
;
test(path);
}
private
static
void
test(String path) {
File f =
new
File(path);
File[] fs = f.listFiles();
if
(fs ==
null
) {
return
;
}
for
(File file : fs) {
if
(file.isFile()) {
System.out.println(file.getPath());
}
else
{
test(file.getPath());
}
}
}
}
|