Moving a file from one location to another using Java
by guruprasad[ Edit ] 2014-01-02 09:47:15
Moving a file from one location to another:
Used function:
renameTo();
Example:
File afile =new File("C:\folderA\Afile.txt"); //getting file name with its
location.
if(afile.renameTo(new File("C:\folderB\" + afile.getName()))){
System.out.println("File is moved successful!");
}else{
System.out.println("File is failed to move!");
}