자바 File 클래스를 이용한 유용한 작업들

조회 1,503 · 댓글 0
주말만기다려주말만기다려작성자2017년 1월 9일
1) Full Path 중 상위 Parent 까지만 추출

String fullFile = "/home/myHome/test.txt";
String parentPath = new File(fullFile).getParent();

2) Parent 디렉토리와 File 결합

String parentPath = "/home/myHome";
String fileName = "test.txt";
String fullPath = new File(parentPath, fileName).getPath();

로그인 후 답글을 남길 수 있습니다.