1 Reply Latest reply: Sep 26, 2006 6:14 AM by 807569 RSS

    Need Help - Problem: Cannot rename the file

    807569
      I hv three type of file, which is original file, processed file and edited file. Then, my goal is change all the three type of filename after i edit and save the document...

      My problem is sometime it can be changed, but sometime it just change either one or two type of filename only.....

      Can somebody to help me........10s first....

      Below is my coding.....

      String nfilename = tokenString[0] + "_edited";
                     
      File original = new File(directoryname + "\\" + "original" + "\\" + tokenString[0] + ".txt");                     
      File noriginal = new File (directoryname + "\\" + "original" + "\\" + nfilename + ".txt");
      boolean success1 = original.renameTo(noriginal);
                          
      File process = new File(directoryname + "\\" + "process" + "\\" + tokenString[0] + ".xml");                         
      File nprocess = new File (directoryname + "\\" + "process" + "\\" + nfilename + ".xml");
      boolean success2 = process.renameTo(nprocess);
                          
      File edit = new File(directoryname + "\\" + "edit" + "\\" + tokenString[0] + ".xml");
      File nedit = new File(directoryname + "\\" + "edit" + "\\" + nfilename + ".xml");                     
      boolean success3 = edit.renameTo(nedit);