자바 파일 복사중이에요 도움좀 주세요
-
게시물 수정 , 삭제는 로그인 필요
import java.io.File;
import java.util.Scanner;
class Test54_1 {
public static void main(String[] args) throws Exception {
Scanner scn = new Scanner(System.in);
System.out.println("pathを入力してください:");
String path = scn.nextLine();
File file = new File(path);
File[] filelist = file.listFiles();
System.out.println("コピーされるパス");
String pastepath = scn.nextLine();
File pastefile = new File(pastepath);
int temp=0;
if (filelist != null) {
System.out.println("検索");
var c = scn.nextLine();
for (int a = 0; a < filelist.length; a++) {
if (filelist[a].equals(c)) {
temp = a;
while(temp==filelist.length) {
if(filelist[temp].isFile()) {
}
}
}
}
}
}
}
이게 제가 생각하는 지정폴더 `path에서
지정 파일또는 폴더의 위치상 아래가 파일이면 복사 한다
이런식으로 구상하고있어요
예를들어
패스 라는 폴더안에
폴더1
폴더2
폴더3
폴더4
파일1
파일2
파일3
이런식으로 있어요
제가 만약에 폴더 3
을 지정하고
위치상 밑에있는 파일1~3만
복사하고싶어요
이런식으로 코드를 짜도 될까요?
지정 파일또는 폴더의 위치상 아래가 파일이면 복사 한다
이런식으로 구상하고있어요
#자바 파일 읽기 #자바 파일 입출력 #자바 파일 생성 #자바 파일 삭제 #자바 파일 다운로드 #자바 파일 #자바 파일 실행 #자바 파일 쓰기 #자바 파일 열기 #자바 파일 복사