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

File.delete does not work on directories.

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      generic

      Description

      From ###@###.### Mon Mar 18 15:55:00 1996
      Date: Mon, 18 Mar 1996 15:52:24 -0800
      From: ###@###.### (Arthur van Hoff)
      To: pavani@Eng
      Subject: File.delete()
      Mime-Version: 1.0


      Hi Pavani,

      It is currently impossible to delete directories from Java.
      The delete() method in java.io.File does not delete the directory
      when the File object refers to a directory (even when it is empty).
      This leaves no alternative way to delete a directory.

      Can you please file a bug against this? It would really help us
      if this gets fixed. I've attached a test program. Thanks!

      Have fun,

      Arthur van Hoff

      -----Test--------------------

      import java.io.File;

      public class Test {
          public static void main(String argv[]) {
      File f = new File(argv[0]);
      System.out.println("mkdir = " + f.mkdir());
      System.out.println("delete = " + f.delete());
          }
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tlindholsunw Timothy Lindholm (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: