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

Files."really"Delete

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 9
    • core-libs
    • None

      The existing method Files.delete does not guarantee synchronous behavior, meaning that on some platforms (i.e. Windows) the file may not have been deleted by the time the method returns.

      For code that relies on the deletion taking place in a timely manner (i.e before proceeding into code that presumes the non-existence of the file in question) this means such code must make sure to pause until it can be verified that the file no longer exists. This code can be tricky to write and get right. (Notice the subtle difference between Files.exists and Files.notExists)

      It would help to have a standard convenience method available that provides synchronous deletion of a file system object.

      It would further help if there was a method to delete the contents of a directory before deleting the directory itself.

            bpb Brian Burkhalter
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: