Problem using renameTo method


EJB design: Problem using renameTo method

  1. Problem using renameTo method (1 messages)

    I am experiencing wired behaviour using renameTo(). Can anyone lemme know wats the exact reason. I have set of directories and file names in .properties file and i'm retriving those values and trying to move the file to temp directory for ex: file: incoming=c:\\com\\incoming
    dirctories=check1,check2 files=file1.txt,file2.txt : forI(int i=0;i<arrDir.length;i++) { File f1 = new File(incoming+arrdirectories[i]+"
    "+arrfiles[i]); File f2 = new File(incoming+arrdirectories[i]+"\\"+"
    temp"+arrfiles[i]); f1.renameTo(f2); } If in case i provide 1 directory and 1 file, its moving the file 2 directory and 2 files, its moving only 2nd file. 3 directory and 3 files, its moving only 3rd file. 4 directory and 4 files, its moving only 4th file. 5 directory and 5 files, its moving all files. 6 directory and 6 files, its moving all files except last file. NOTE: i'm not moving existing files. I have taken care of code part i.e. values from properties file are retrived properly.

    Threaded Messages (1)

  2. More info[ Go to top ]

    Hi Chetan Ramaiah, it seems to me that the problem occurs somewhere in the code that you didn't show. How do you fill variable arrdirectories and arrfiles? I know you said you properly retrieved those properties. But can you show us that part of code? What does arrDir variable in the for loop head stand for? Reagrds Martin.