public static void main(String[] args) {
// TODO Auto-generated method stub
String path = "D:\\EA7.5\\";
File file = new File(path);
System.out.printf("文件\t\t\t\t大小\t类型\t修改日期\t","");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String[] flist = file.list();
for(String s:flist){
File file1 = new File(path+s);
System.out.println(file1.getName()+file1.length()+"\t"+(file1.isDirectory()?"文件夹":"文件")+"\t"+sdf.format(new Date(file1.lastModified())));
}
}
排版没排好,表示不知道怎么排,只做笔记用
学习笔记- 查看一个文件夹下的文件及文件夹,仿Windows资源管理器
最新推荐文章于 2021-12-27 17:43:43 发布