Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 무선랜카드
- utf-8
- 따라다니는 배너
- replace
- javascript
- form
- 시놀로지
- println
- disabled
- RTL88x2BU
- jquery 레이어
- jQuery
- euc-kr
- DS718+
- synology
- FileSystemObject
- ajax
- submit
- 커널
- ASP
- Injection
- AC1300
- lsusb
- readonly
- include
- Getrows
- XMLHTTP
- 크로스 컴파일
- SQL Injection
- PHP GCM
Archives
- Today
- Total
아는 것이 좋은 것이다.
[Java] 폴더에 있는 파일을 다른폴더로 이동 본문
import java.io.*; //입출력 public class Image_Move { public static void main(String[] args) { // TODO Auto-generated method stub //폴더 참조 File original_dir = new File("D:\\aaaaa\\bbbbb"); //절대경로 File move_dir = new File("D:\\aaaaa\\ccccc"); if(original_dir.exists()) { //폴더의 내용물 확인 -> 폴더 & 파일.. File[] fileNames = original_dir.listFiles(); //내용 목록 반환 //System.out.println("--------------폴더 읽기-----------------"); //for(int i=0; i< fileNames.length; i++) { //if(fileNames[i].isDirectory()) { //System.out.println(fileNames[i].getName()); //폴더 존재 유무 //} //} System.out.println("--------------파일 읽기-----------------"); for(int i=0; i< fileNames.length; i++) { if(fileNames[i].isFile()) { if(fileNames[i].exists()) { if(original_dir.exists()) { } File MoveFile = new File(move_dir, fileNames[i].getName()); // 이동될 파일 경로 및 파일 이름 fileNames[i].renameTo(MoveFile); //변경(이동) System.out.println(fileNames[i].getName()); // 폴더내에 있는 파일 리스트 } } } } } }
'Java Programing' 카테고리의 다른 글
[Java] URL 이미지 다운로드 (0) | 2014.06.09 |
---|---|
[Java] 자바 로그 저장 (0) | 2014.06.03 |
[Java] 문자열 세기 Length (0) | 2014.06.01 |
[Java] 숫자를 문자열로 바꾸기, 문자열을 숫자로 바꾸기 (0) | 2014.05.31 |
[Java] 로그 저장, System.out.println 데이터 저장 (0) | 2014.05.07 |
Comments