티스토리 뷰
public class FileWriterTest{
public static void main(String[] args){
System.out.println("Start");
String txt="테스트";
String path="D:\\batch\\";
File f=new File(path);
String pathFile="";
String fileName="text";
String ext=".txt";
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
Date date = new Date();
String yyyyMMdd=sdf.format(date);
pathFile=fileName+"_"+yyyyMMdd+ext;
Calendar cal =new GregorialCalendar();
cal.add(Calendar.DATE, -1_;
String yest=sdf.format(cal.getTime(););
pathFile=path+pathFile;
try{
File file =new File(pathFile);
FileReader fileReader=new FileReader(file);
BufferedReader bufReader = new BufferedReader(fileReader);
String line="";
while( (line = bufReader.readLine())!=null){
System.out.println(line);
}
bufReader.close();
if(!fm.isDirectory()){
fm.mkdir();
}
Path p=Paths.get(pathFile);
Path pathMove=Paths.get(movePath);
Files.move(p, pathMove.resolve(p.getFileName()));
}catch(Exception e){
e.printStackTrace();
}
System.out.println("End");
}
}
public static void main(String[] args){
System.out.println("Start");
String txt="테스트";
String path="D:\\batch\\";
File f=new File(path);
String pathFile="";
String fileName="text";
String ext=".txt";
SimpleDateFormat sdf=new SimpleDateFormat("yyyyMMdd");
Date date = new Date();
String yyyyMMdd=sdf.format(date);
pathFile=fileName+"_"+yyyyMMdd+ext;
Calendar cal =new GregorialCalendar();
cal.add(Calendar.DATE, -1_;
String yest=sdf.format(cal.getTime(););
pathFile=path+pathFile;
try{
File file =new File(pathFile);
FileReader fileReader=new FileReader(file);
BufferedReader bufReader = new BufferedReader(fileReader);
String line="";
while( (line = bufReader.readLine())!=null){
System.out.println(line);
}
bufReader.close();
if(!fm.isDirectory()){
fm.mkdir();
}
Path p=Paths.get(pathFile);
Path pathMove=Paths.get(movePath);
Files.move(p, pathMove.resolve(p.getFileName()));
}catch(Exception e){
e.printStackTrace();
}
System.out.println("End");
}
}
'자바(Java)' 카테고리의 다른 글
자바 새벽시간일 경우 이전 날짜로 (0) | 2019.08.06 |
---|---|
java – 날짜 문자열에서 시간 추출 (0) | 2019.08.06 |
자바 개행문자 추가 파일 쓰기 (0) | 2019.08.05 |
자바 파일 쓰기 (0) | 2019.08.05 |
jsp에서 config.properties 파일 읽는 방법 (0) | 2019.08.02 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- ocajp
- php
- ocjap
- 이클립스
- C
- xe애드온
- 프로씨
- 자바 smtp
- 스크래핑
- 오라클
- 파이썬
- 인포믹스
- 문자열
- XE
- 플러터
- xe addon
- 자바
- 포인터
- webix
- MySQL
- esql
- KG
- JDBC
- XE3
- Python
- 라이믹스 모듈
- EC
- proc
- C언어
- 파싱
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함