This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes renameTo(File dest) Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "renameTo(File dest) Method " Watch "renameTo(File dest) Method " New topic
Author

renameTo(File dest) Method

Saurabh Agrawal
Ranch Hand

Joined: Oct 07, 2003
Posts: 244
Hello all,
I am unable to understand the renameTo method of the File class in JAVA.It says that it renames the file denoted by this abstract pathname.

But in one of the application which we developed, we are using this method to transfer the file to a destination.So what we do is , we encrypt the file and send that file to the destination which can be any path .

So can anyone clear my doubts on the same?

Thanks in advance,

Saurabh


Success is not doing extraordinary things but doing ordinary things extraordinarily well.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41626
    
  55
The Javadocs say "Renames the file denoted by this abstract pathname. Whether or not this method can move a file from one filesystem to another is platform-dependent."
So it can both rename and move (although the latter may fail under certain circumstances). What exactly are your doubts about this? And what does encryption have to do with it?
(Note that Unix -e.g.- uses the same command -mv- for renaming and moving.)


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: renameTo(File dest) Method