Hi Jay,

You know, people on this list *could* take offence to the fact that you
are deliberately posting off-topic after trying on hopefully more
on-topic lists...but you did flag it, so that is some consolation.

I use renameTo() all this time, no problems.  I did have a bit of a
misunderstanding at first, because I was trying to use it like the Unix
"mv" command and move a file into a directory, which didn't work.  You
have to specify a File object that identifies the destination file, not
just it's directory.  Also, by default it will not succeed if the
destination file already exists, so you should check for this first (or
on error, I guess).

It would be nice if they overloaded the renameTo() method with a few
more versions, including one with an "overwrite" parameter.

Regards
Drew

> -----Original Message-----
> From: Jay Baker [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, October 20, 1999 3:52 AM
> To:   [EMAIL PROTECTED]
> Subject:      OFF TOPIC : moving / renaming a file
>
> I tried another list on this but wasn't able to resolve, so I thought
> I would try here.
>
> I'm looking for some direction in moving / renaming a file. I've tried
> File.renameTo(). I am getting false as a return on this and can't
> figure out why. I can create new with the same path and file name. Is
> renameTo() the preferred method for moving a file?
>
> Jay Baker
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to