Adding "_old" to a file name
I think that the approach of the question lacks only a better usage of the API of java.nio.file.Path.

Using the old java.io.File seems very ugly nowadays, when we have java.nio.*, where all the stuff like file separators is supported much better.

// ...
String originalFile = "/path/to/myFile.txt";
Path originalPath = Paths.get(originalFile);
String backupFileName = buildBackupFileName(originalPath.getFileName().toString());
Path backupPath = originalPath.getParent().resolve(backupFileName);
Files.move(originalPath, backupPath); // add options if necessary
// ...

private static String buildBackupFileName(String fileName) {
  String backupSuffix = "_old"; // or move it in a static constant 
  int lastDotIndex = fileName.lastIndexOf(".");
  if (lastDotIndex &gt; -1) {
    return fileName.substring(0, lastDotIndex) + backupSuffix + fileName.substring(lastDotIndex);
  }
  return fileName + backupSuffix;
}


Other ways to build the backup file name: use StringBuilder or String.format, with or without the above FilenameUtils.