This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mahender Rao
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does "i am not able" mean? TellTheDetails
 
Mahender Rao
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hint: Log out the exact path of your before and after paths, what do you get?
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are correct yes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic