Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8331310

Add Files.rename

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      `Files` provides many convenient utilities. However, when you need to simply rename a file, you still have to jump through some loops
      1. You have to use a semantically incorrect `move()` method
      2. You have to specify the path to your file twice
      ```java
      @SneakyThrows
      void renameFile() {
      Path source = Paths.get("foo/bar/baz/text.txt");
      Path target = Paths.get("foo/bar/baz/text2.txt");
      Files.move(source, target);
      }
      ```
      It would be much better if `Files` provided a `rename(Path file, String newName)` method OOB



      Attachments

        Activity

          People

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: