code: public static boolean execute(
      final File source, final File destination, boolean renameEmptyFiles) {
      if (renameEmptyFiles || (source.length() > 0)) {
        return source.renameTo(destination);
      }
  
      return source.delete();
    }
docs: Rename file.
  @param source current file name.
  @param destination new file name.
  @param renameEmptyFiles if true, rename file even if empty, otherwise delete empty files.
  @return true if successfully renamed.