+ public static boolean moveFileToFile(File oldFile, File newFile)
+ {
+ Console.initLogger();
+ boolean ret = false;
+ Path oldPath = Paths.get(oldFile.getAbsolutePath());
+ Path newPath = Paths.get(newFile.getAbsolutePath());
+ try
+ {
+ // delete destination file - not usually necessary but Just In Case...
+ Console.trace("BACKUPFILES deleting " + newFile.getAbsolutePath());
+ newFile.delete();
+ Console.trace("BACKUPFILES moving " + oldFile.getAbsolutePath()
+ + " to " + newFile.getAbsolutePath());
+ Files.move(oldPath, newPath, StandardCopyOption.REPLACE_EXISTING);
+ ret = true;
+ Console.trace("BACKUPFILES move seems to have succeeded");
+ } catch (IOException e)
+ {
+ Console.warn("Could not move file '" + oldPath.toString() + "' to '"
+ + newPath.toString() + "'");
+ Console.error(e.getMessage());
+ Console.debug(Cache.getStackTraceString(e));
+ ret = false;
+ } catch (Exception e)
+ {
+ Console.error(e.getMessage());
+ Console.debug(Cache.getStackTraceString(e));
+ ret = false;
+ }
+ return ret;
+ }