Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import java.io.*;
import java.nio.file.Files;
import java.nio.file.*;
public class MoveFilesDemo {
public static void main(String[] args) throws IOException
{
Path temp = Files.move
(Paths.get("C:\\temp\\testfile.txt"),
Paths.get("C:\\Program Files\\testfile.txt"));
if(temp != null)
{
System.out.println("File renamed and moved successfully");
}
else
{
System.out.println("Failed to move the file");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.