Possible duplicate:
Copy files from one directory to another in Java
How to transfer all files from one folder to another folder using java? I am using this code:
import java.io.File;
public class Vlad {
public static void main(String[] args) {
File file = new File("C:\\Users\\i074924\\Desktop\\Test\\vlad.txt");
File dir = new File("C:\\Users\\i074924\\Desktop\\Test2");
boolean success = file.renameTo(new File(dir, file.getName()));
if (!success) {
System.out.print("not good");
}
}
}
but it only works for one specific file.
thank!!!
source
share