Java examples for File Path IO:Directory Move
Moving a File or Directory to Another Directory
import java.io.File; public class Main { public static void main(String[] argv) throws Exception { // File (or directory) to be moved File file = new File("filename"); // Destination directory File dir = new File("directoryname"); // Move file to new directory boolean success = file.renameTo(new File(dir, file.getName())); if (!success) { // File was not successfully moved }/* w w w .j a v a 2 s .c o m*/ } }