top
-dir1 (inside top)
--txt files (inside dir1)
-dir2 (inside top)
--dir3 (inside dir2)
---txt files (inside dir3)
I'm using the following function to try and change the name.
String x is the folder name that I want to change and String y is the new name for the folder.
public static void renameDirectory(String x, String y)
{
//System.out.println(x);
//System.out.println(y);
String file = new File("").getAbsolutePath();
String files = new File("").getAbsolutePath();
file = file+"\\top\\"+x;
files = files+"\\top\\"+y;
//System.out.println(file);
//System.out.println(files);
File filer = new File(file);
File filed = new File(files);
boolean renamed = filer.renameTo(filed);
System.out.println(renamed);
}
Any ideas why it keeps failing to change the folder name?

New Topic/Question
Reply


MultiQuote



|