首页 > 代码库 > File List
File List
1 public class Question1 { 2 3 public static void main(String[] args) { 4 String dir=""; 5 if(args.length!=1) 6 { 7 System.out.println("Please Enter Path of the Directory"); 8 System.exit(0); 9 }else{10 File f=new File(args[0]);11 if(f.exists() && f.isDirectory())12 {13 File[] list=f.listFiles();14 System.out.format("%-70s%-10s%-10s%-15s\n","Name","Size","Type","Last Modified");15 System.out.println("======================================================================================================================");16 for(File file:list){17 if(file.isDirectory())18 dir="<DIR>";19 else20 dir="";21 System.out.format("%-70s%-10s%-10s%-15s\n",file.getName(),file.length()/1024+" KB",dir,new Date(file.lastModified()));22 }23 }24 else25 System.out.println("Not an Existing Directory");26 }27 }28 29 }
File List
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。