try {
File realFile = new File(file);
boolean rename = realFile.renameTo(new File("C:\\Dummy Files 2\\" + file));
if (rename) {
System.out.println(file + " was moved succesfully");
boolean delete = realFile.delete();
if (delete) {
System.out.println(realFile.getAbsolutePath() + " was deleted");
} else {
System.out.println(realFile.getAbsolutePath() + " could not be deleted");
}
} else {
System.out.println(file + " could not be moved");
}
Above is the snippet of code I am using to move files. The files don't get moved, and they don't get deleted, as a result.
System.out.println(file + " could not be moved");
This is printed out every time. I have no idea what I'm doing wrong. Help or advice would be greatly appreciated.