codice:
public static void moveFile(String filePath, String dirPath) throws Exception {
File file = new File(filePath);
if(!file.renameTo(new File(dirPath + "\\" + file.getName()))) {
throw new Exception("Cannot move file " + file.getAbsolutePath());
}
}
public static void move(File song, File dir) {
try {
moveFile(song.getAbsolutePath(), dir.getAbsolutePath());
}
catch(Exception e) {
System.out.println("\nEccezione nel spostare il file " + song.getAbsolutePath());
e.printStackTrace();
}
}
Stampando le due stringhe, queste sono corrette.
Il processo aperto potrebbe essere il listener associato al bottone della GUI che fa tutto ciò?
Si sono sicuro di non avere già il file aperto..