> if File.renameTo method returns true does that mean that the file is
> definitely moved? Sometimes I see this method returning true, and yet the
> file is not moved at all - any general ideas about where a problem could be?
Yes, the file is definitely moved if that method returns true. Can you
post a self-contained example of code that fails?

Signature
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
Peter Kirk - 19 May 2004 16:47 GMT
> > if File.renameTo method returns true does that mean that the file is
> > definitely moved? Sometimes I see this method returning true, and yet the
> > file is not moved at all - any general ideas about where a problem could be?
>
> Yes, the file is definitely moved if that method returns true. Can you
> post a self-contained example of code that fails?
Hi, thanks heaps for the reply - I have found my problem. It was because I
was using the wrong path to write to, and ended up "moving" the file to
itself.
(It was via a complicated chain of events, of which the root cause was
probably that the "constant" String representing the destination directory
was not declared final meaning that another programmer unwittingly changed
its value).
Peter
>if File.renameTo method returns true does that mean that the file is
>definitely moved? Sometimes I see this method returning true, and yet the
>file is not moved at all - any general ideas about where a problem could be?
The safest and fastest sort of rename is when the new name is in the
same directory.
If it is on a different drive, it definitely won't work.
See http://mindprod.com/jgloss/temporaryfiles.html for how to create
temps that are in the right place for renaming.

Signature
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.