wood burning stoves 2.0*
The moose likes Other Open Source Projects and the fly likes Problem with moving a file from one Directory to other Directory using FTPClient rename Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Problem with moving a file from one Directory to other Directory using FTPClient rename Method" Watch "Problem with moving a file from one Directory to other Directory using FTPClient rename Method" New topic
Author

Problem with moving a file from one Directory to other Directory using FTPClient rename Method

Mahender Rao
Greenhorn

Joined: Oct 28, 2008
Posts: 7
Helo Friends,

I want to move the file from DataFeed/testData.zip to other Directory NewDataFeed/testData.zip with in the FTPServer, for that i am using ftpClient.rename method, but i am not able to move the file, my code is as follows



Ranchers, Please help me.....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41586
    
  54
What does "i am not able" mean? TellTheDetails


Ping & DNS - my free Android networking tools app
Mahender Rao
Greenhorn

Joined: Oct 28, 2008
Posts: 7
Thanks Ulf Dittmer,




After execution of above method the file was not moved from DataFeed folder to NewDataFeed Folder, it still exists in DataFeed folder and the rename method returning false.

So, my doubt is that the parameters whatever i am passing for rename method, are they right?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hint: Log out the exact path of your before and after paths, what do you get?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41586
    
  54
You shouldn't ignore the return value of the "rename" call - I'm fairly certain it's "false".

I think the call to changeWorkingDirectory messes things up.
Mahender Rao
Greenhorn

Joined: Oct 28, 2008
Posts: 7
Yeah....Thanks Dittmer...

I got the solution, the problem is with the
changeWorkingDirectory("DataFeed/");
If i give that it looks for the file in DataFeed/DataFeed/ directory. Since i am giving absolute paths in rename method, there is no need of changeWorkingDirectory.

Am i right Dittmer???

once again thanks....


Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

You are correct yes.
 
 
subject: Problem with moving a file from one Directory to other Directory using FTPClient rename Method