고급코드
2006. 9. 27. 22:02
2006. 9. 27. 22:02
public class FileInfo
{
public static void main
(String args
[]) {
if(args.length!=1) {
System.
out.
println(" ex) : java FileInfo <파일이름>" );
}
if(infoFile.exists()) {
System.
out.
println("파일이름 : " + infoFile.
getName());
System.
out.
println("상대경로 : " + infoFile.
getPath());
System.
out.
println("절대경로 : " + infoFile.
getAbsolutePath());
System.
out.
println("쓰기가능 : " + infoFile.
canWrite());
System.
out.
println("읽기가능 : " + infoFile.
canRead());
System.
out.
println("숨은파일 : " + infoFile.
isHidden());
System.
out.
println("파 일 : " + infoFile.
isFile());
System.
out.
println("디렉토리 : " + infoFile.
isDirectory());
System.
out.
println("파일크기 : " + infoFile.
length() +
"Byte");
System.
out.
println("최종수정 : " + infoFile.
lastModified());
} else {
System.
out.
println("파일이 없습니다.");
}
}
}