Created
August 19, 2019 13:57
-
-
Save gandra/911f465217011e2dfec1a8e561c0bb57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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