• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.....
 
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does "i am not able" mean? TellTheDetails
 
Mahender Rao
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hint: Log out the exact path of your before and after paths, what do you get?
 
Ulf Dittmer
Rancher
Posts: 43026
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct yes.
 
In the renaissance, how big were the dinosaurs? Did you have tiny ads?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic