Re: Renaming and Moving Files:
Danger_Duck wrote:
[...]
When I tried (res is the existing file),
res.renameTo(new File(resultsLocation.concat("/" + test.getName() +
"_results.txt")))
I indeed found a new file with the name I specified. Unfortunately, it
was blank, as the 0kb size confirmed. That's why I either need help
with renameTo or a better method.
By the way, res already exists (with contents and 1kb in size), and
was opened using:
File res = new File(resultsLocation.concat("/results.txt"));
This doesn't "open" anything at all. The poorly-named File class
does not represent files, but file names -- or, rather, names that
could potentially describe files, because the existence of a name does
not imply the existence of the file. Your `res' is just a name for a
file, and the file itself may or may not exist.
I'm on a Windows XP by the way, if that matters...
Perhaps it's time for you to post a short, complete, compilable
example of your code, instead of a few isolated snippets. As it is,
we're all just guessing about what you're doing, and debugging our
guesses for you ...
--
Eric.Sosman@sun.com