In a method where I move files, when I pass the parameters and perform the operation, I always get an error. If something is failing me, could you help me?
public void MoverArchivo(String oldPath, String oldName, String newPath) {
File f = null;
File f1 = null;
boolean bool = false;
try {
f = new File(oldPath+oldName);
f1 = new File(newPath+oldName);
if(f.renameTo(new File(newPath+oldName))) {
System.out.println("Archivo removido");
} else {
System.out.println("El archivo "+ oldName + " no pudo ser cambiado de destino");
}
} catch(Exception e) {
System.out.println("ADVERTENCIA: El archivo " + oldName + " no pudo ser cambiado de destino, CAUSA:" + e);
}
System.out.println("Termina archivo "+oldName);
System.out.println("----------------------------------------------------------------");
}