336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

package IO;

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Scanner;

public class copyFile {
    public static void main(String[] args){
        try {
            Scanner s=new Scanner(System.in);
            //System.out.println(s.nextLine());
            //int i=s.nextInt()*100;
            //System.out.println(i);
            System.out.println("원본파일");
            String sourceFile= s.nextLine();
            System.out.println();
            System.out.println("복사파일");
            String copyFile=s.nextLine();
            System.out.println(sourceFile+":"+copyFile);
                   
            File sFile=new File(sourceFile);
            File cFile=new File(copyFile);
           
            FileReader fr=new FileReader(sFile);
            FileWriter fw=new FileWriter(cFile);
           
            int c;
            while ((c=fr.read())!=-1) {
                fw.write(c);
            }
            fw.close();
            fr.close();
            System.out.println("Copy End !!");
        } catch (Exception e) {
                e.printStackTrace();
        }
    }
}

'Java' 카테고리의 다른 글

UrlFrame, getting the page source and save as a txt file  (0) 2015.01.06
URL class, figuring the page source  (0) 2015.01.06
Fileclass methods  (0) 2015.01.03
searching Directories  (0) 2015.01.03
a Simple example copying a file  (0) 2015.01.03
Posted by af334