获取指定文件夹下的内容
来源:互联网 发布:android软件源代码 编辑:程序博客网 时间:2024/04/27 16:32
package FileView;
import java.io.File;
public class FileViewer {
public static void main(String[] args) {
// This is the path where the file's name you want to take.
String path = "E:\\Read";
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());
}
}
}
}
import java.io.File;
public class FileViewer {
public static void main(String[] args) {
// This is the path where the file's name you want to take.
String path = "E:\\Read";
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());
}
}
}
}
0 0
- 获取指定文件夹下的内容
- IOS下获取文件夹下的内容
- Python学习(一)获取指定文件夹下的文件名及其内容
- Python获取指定文件夹下的文件名
- 获取指定路径下的文件夹名
- python 获取指定文件夹下的文件名
- 从指定文件夹下获取指定格式的文件
- python 遍历指定文件夹下的所有文件内容
- 获取Assets文件夹下内容
- java获取指定文件夹下的所有文件名
- symbian 获取指定路径下的文件夹和文件列表
- java获取指定文件夹下的所有文件名
- symbian 获取指定路径下的文件夹列表
- ListView获取指定目录下的所有文件及文件夹
- Excel VBA 获取指定路径下的文件夹名称
- php获取指定文件夹下的所有子文件
- 关于C++中获取指定文件夹下的所有文件
- .NET获取指定文件夹下的所有文件
- ======ps cs6.0破解======
- linux下设置ssh无密码登录
- Java利用反射机制遍历成员变量
- 使用R语言实现的城市空气质量分析模型
- Objective-C中一种消息处理方法performSelector: withObject:
- 获取指定文件夹下的内容
- HTTP协议详解
- 对涂胶工艺认识的误区:涂胶操作环境好坏不重要,关键是设备
- 吴奇隆、诗诗领证,若曦和四爷在一起啦
- Lingo规划问题求解
- 《统计学习方法,李航》:8、提升方法Boosting(2)
- Opencv ---- ROI区域图像叠加 & 初级图像混合
- Flexslider图片轮播、文字图片相结合滑动切换效果
- require之二