+ public static boolean moveFileToFile(File oldFile, File newFile)
+ {
+ Cache.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...
+ Cache.trace("BACKUPFILES deleting " + newFile.getAbsolutePath());
+ newFile.delete();
+ Cache.trace("BACKUPFILES moving " + oldFile.getAbsolutePath() + " to "
+ + newFile.getAbsolutePath());
+ Files.move(oldPath, newPath, StandardCopyOption.REPLACE_EXISTING);
+ ret = true;
+ Cache.trace("BACKUPFILES move seems to have succeeded");
+ } catch (IOException e)
+ {
+ Cache.warn("Could not move file '" + oldPath.toString() + "' to '"
+ + newPath.toString() + "'");
+ Cache.error(e.getMessage());
+ Cache.debug(Cache.getStackTraceString(e));
+ ret = false;
+ } catch (Exception e)
+ {
+ Cache.error(e.getMessage());
+ Cache.debug(Cache.getStackTraceString(e));
+ ret = false;
+ }
+ return ret;
+ }