renameTo for directories

I tried to rename a directory and found the logic of it
was no good. It is suppose to be if e:\cache\one.txt
exists then rename e:\cache to e:\cache1. I tried defining
the variables as File such as f1=new file("e:\cache") but
no luck. I dont understand the arg[] idea too well. Can you
tell me a good source on addition instructions for renameTo?

Who is Participating?

the backslash character was escaping c, which meant "stay on the same line." The file separator is a platorm neutral version of a / or \ or : directory separator. You might consider using a FileDialog to prompt the user for the location of the cache. if you want details on how to do this, just email me and i'll show you some examples.

Regarding args[],

your main function looks like this:

public static void main(String[] args)

args is an array that refers to the command line arguments. if the program has any arguments you can pick them up. For example if the program was invoked like:

% java myProgram firstArg secondArg

then in your code you could reference the arguments like:

String frist = args[0];
String second = args[1];

Notice that this is different from C++ where args[0] refers to the name of the program, while in Java it refers to the first argument.

Good luck!

0

johnh619Author Commented: 1998-06-20

I assume then that number args are only for the command line.
So I am not wanting to use the command line as input. I will
use choice box. I think your suggestion for file separator may
fix my problems though, so thanks. John H