First of all you need to wrap everything in try/catch and log the exception block to figure out what error is with help of exception.getMessage()
Than the example of copying file is the following
InputStream inStream = null;
OutputStream outStream = null;
try{
File afile =new File("C:\\foldeOne\\Afile.txt");
File bfile =new File("C:\\foldeTwo\\Afile.txt");
inStream = new FileInputStream(afile);
outStream = new FileOutputStream(bfile);
byte[] buffer = new byte[1024];
int length;
//copy the file content in bytes
while ((length = inStream.read(buffer)) > 0){
outStream.write(buffer, 0, length);
}
inStream.close();
outStream.close();
//delete the original file
afile.delete();
System.out.println("File is copied successful!");
}catch(IOException e){
//Here you suppose to handle exception to figure out what went wrong
e.printStackTrace();
}
}
original was here https://www.mkyong.com/java/how-to-move-file-to-another-directory-in-java/