Here you can find the source of moveDirectory(Path srcPath, Path destPath)
public static void moveDirectory(Path srcPath, Path destPath) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; public class Main { public static void moveDirectory(Path srcPath, Path destPath) throws IOException { if (!srcPath.toFile().isDirectory()) { throw new IOException(srcPath.toAbsolutePath().toString() + " is not a directory!"); }/* ww w. j a va 2s.c om*/ if (!destPath.toFile().exists()) { //noinspection ResultOfMethodCallIgnored destPath.toFile().mkdirs(); } Files.move(srcPath, destPath, StandardCopyOption.REPLACE_EXISTING); } }