-
JAVA列出某文件夹下的所有文件
- import java.io.*;
-
- public class ListFiles {
-
- private static String s = "";
- private static BufferedReader in = new BufferedReader(
- new InputStreamReader(System.in));
-
- public static void main(String[] args) {
-
- try {
- s = in.readLine();
- getFileList(s);
- in.close();
-
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- public static void getFileList(String directory) {
-
- File f = new File(directory);
- File[] files = f.listFiles();
- for (int i = 0; i < files.length; i++) {
- if (files[i].isFile()) {
- System.out.println("文件:" + files[i]);
- } else {
- System.out.println("目录:" + files[i]);
-
- getFileList(files[i].getAbsolutePath());
-
- }
- }
- }
- }
-
相关阅读:
jsp获取当前目录下的文件和目录,获取windows盘符
WAS常用配置的文件
Was提示SOAP链接不上可能停止 但WAS已经启动
git本地仓库提交到远程
ubuntu1804时间相差8小时
docker安装&卸载
ubuntu 安装离线字典
写给还没入门的网页设计师们
简单10步,建立一个完美的商业网站
不会配色?来看看网页设计中怎样使用柔和色调
-
原文地址:https://www.cnblogs.com/GodZhe/p/4790863.html
Copyright © 2020-2023
润新知