本帖最后由 隋营营 于 2012-5-8 11:46 编辑
OK,搞定了:
public class Testext {
public static void main(String[] args) throws Exception {
BufferedReader bufr = new BufferedReader(new InputStreamReader(
System.in));
String input = null;
while (null != (input = bufr.readLine())) {
File file = new File(input);
for (File f : file.listFiles()) {
System.out.println(f.getName());
}
}
}
}
注意输入目录的格式:
s:/java
或:
s:\\java
|