나는 내 PC에서 주어진 확장자를 가진 파일을 검색 할 프로그램을 작성합니다. 이제는 한 가지 더 추가하고 싶습니다. 내 프로그램에서이 파일을 내 PC의 특정 위치로 복사 해 주시기 바랍니다. 당신이 파일을 복사 할 당신이, 당신은 위치에 출력 FileOutputStream
의를 만들 수 있습니다 복사 할 파일에 대한 FileInputStream
의이 있으면검색된 파일을 특정 위치에 복사하십시오.
Finder(String pattern)
{
matcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern);
}
// Compares the pattern against
// the file or directory name.
void find(Path file) {
Path name = file.getFileName();
if (name != null && matcher.matches(name)) {
System.out.println(file);
String s = new String(name.toString());
//System.out.println(s);
File f = new File(s);
//System.out.println(f.getAbsolutePath());
FileInputStream fileInputStream = null;
여기서 정확히 질문은 무엇입니까? – Matthias
체크 [이 스레드] (http://stackoverflow.com/questions/1146153/copying-files-from-one-directory-to-another-in-java) –
나는 내 모든 텍스트 파일을 복사하려면 내 pendrive에 PC. 내 프로그램이 성공적으로 모든 텍스트 파일을 검색하고 지금은이 복사하고 싶습니다 .. 어떻게이 일을 할 수 있습니까 ?? – Vicky