0
프로젝트에서 작업하고 있으며 프로그램에서 다른 디렉터리를 호출하는 Python 스크립트에 의해 생성 된 파일 및 디렉터리를 이동해야합니다.한 디렉터리에서 다른 디렉터리로 모든 파일 및 폴더 이동
파일을 올바르게 복사하지만 디렉토리를 복사하지 않는 코드가 있습니다.
누구든지이 작업을 수행하는 방법을 알고 있습니까? 내 현재 코드가 포함되어 있습니다.
File baseDir = new File(System.getProperty("user.dir"));
File destDir = new File("%userprofile%\\docs");
File[] files = baseDir.listFiles();
for (int i=0;i<files.length;i++) {
if (!files[i].getName().endsWith(".jar") || files[i].isDirectory()) {
files[i].renameTo(new File(destDir,files[i].getName()));
files[i].delete();
}
}
이 하나 봐 - http://stackoverflow.com/questions/11651900/how-to-recursively-copy-entire-directory-including-parent-folder-in-java – Amit