import java.io.*;
import java.util.*;

public class TestFile {
    public static void main(String[] args) {
        try{
            File f1=new File(args[0]);
            File f2=new File(args[1]);
            RandomAccessFile raf=new RandomAccessFile(f2,"rw");
            if(f1.isDirectory()){
                raf.writeChars("E:\\test中包含以下内容:\n");
                File[] fs=f1.listFiles();
                for(int i=0;i<fs.length;i++){
                    if(fs[i].isDirectory()){
                        raf.writeChars("目录 名称:"+fs[i].getName()+",最后修改:"+new Date(f2.lastModified()).toString()+"\n");
                        continue;
                    }
                    if(fs[i].isFile()){
                        raf.writeChars("文件 名称:"+fs[i].getName()+", 最后修改:"+new Date(f2.lastModified()).toString()
                                +","+(fs[i].canRead()?"可读 ":"不可读")+(fs[i].canWrite()?"可写 ":"不可写 ")+
                                (fs[i].isHidden()?"隐藏 ":"非隐藏 \n"));
                        continue;
                    }
                }
                raf.close();
            }else{
                raf.writeChars("目录名:E:\\Test不存在!\n");
    //            System.out.println("目录名:E:\\Test不存在!");
                raf.close();
            }
        }catch(ArrayIndexOutOfBoundsException e){
            System.out.println(e.toString());
        }catch(Exception e){
            e.printStackTrace();
        }
    }
}