4 Replies Latest reply on Aug 23, 2007 6:30 PM by 807605

    Trouble deleting files


      I have a servlet running on a Win XP server which runs code:
      String path = ("c:\\monolith2\\build\\web\\plots"); 
      File dir = (new File(path));
      if (dir.isDirectory()) {
        String[] children = dir.list();
        for (int i = 0; i < children.length; i ++) {
            File fileToDelete = (new File(children));

      To delete all the files in folder 'dir '.

      However, the files do not get deleted regardless of what I try and I cannot see why.

      Messages placed in the code shows that the folder is being found and I can list the files but the delete does not work.

      Any ideas? I have tried executing batch files to do the deletes but to no avail.


      Martin O'Shea.