java获取指定文件夹下的所有文件名
2024-10-11 06:03:20
package com.henu.util; import java.io.File; public class TakeFilePathAndName { public static void main(String[] args) {
// This is the path where the file's name you want to take.
String path = "C://Documents and Settings//yinxm//デスクトップ//TestFile";
getFile(path);
} private static void getFile(String path) {
// get file list where the path has
File file = new File(path);
// get the folder list
File[] array = file.listFiles(); for (int i = 0; i < array.length; i++) {
if (array[i].isFile()) {
// only take file name
System.out.println("^^^^^" + array[i].getName());
// take file path and name
System.out.println("#####" + array[i]);
// take file path and name
System.out.println("*****" + array[i].getPath());
} else if (array[i].isDirectory()) {
getFile(array[i].getPath());
}
}
}
}
最新文章
- Oracle基础维护02-表、主键、索引、表结构维护手册
- Tomcat:基于Apache+Tomcat的集群搭建
- Unity Shader入门基础(一)
- 转simhash与重复信息识别
- U3D各路径实例
- mysql数据导入
- 【英语】Bingo口语笔记(64) - Beat系列
- 使用EMMET中的小坑
- Linux 查看文件内容的命令
- c++11 线程:让你的多线程任务更轻松
- unity节目素材ProceduralMaterial采用
- Struts2从头到脚--学习笔记(自认为比较重要的)
- Mysql的学习笔记(一)--检验数据库是否安装成功以及一些入门的简单的dos命令
- C语言第三次程序设计作业
- ansj原子切分和全切分
- Python3 tkinter基础 Text window 文本框中插入按钮
- Atom插件安装及推荐
- docker 命令集
- 一图解释PHPstorm代码片段设置---附官方文档(转)
- numpy的ravel()和flatten()函数比较
热门文章
- MOD 10,11算法(GB/T 17710-1999 数据处理 校验码系统 )的 Python实现
- ARM 内核
- windows下thrift的使用(C++)
- C# String.Format 格式化字符串 数字/时间
- BZOJ.2428.[HAOI2006]均分数据(随机化贪心/模拟退火)
- hdu 2819 记录路径的二分匹配
- 拆分Cocos2dx渲染部分代码
- PAT甲级1127. ZigZagging on a Tree
- 基于Landmark的人脸对齐以及裁剪方法
- python模块整理30-uui模块