Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Want a mehtod in org.apache.commons.net.ftp  RSS feed

 
ravi kumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am developing FTP code with the help of org.apache.commons.net.ftp.
My reqirement is To display all the directory names form a particular folder from server(remote) machine.I cant able to find any method like this in org.apache.commons.net.ftp api.So,Please help me in this regard.
THANKS IN ADVANCE..
-Ravi Kumar
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use one of the FTPClient.listFiles methods to obtain an array of all files in a directory. Then you can check whether each entry is a file or directory by using the FTPFile.getType method, and ignore evertyhing that's not a directory.
 
ravi kumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,
Thanks a lot for your reply.Now I got the directory names like the below from the remote unix box:
drwxrwxrwx 2 bslops1 dstage 512 Sep 26 13:26 cmdb
drwxrwxrwx 2 bslops1 dstage 1024 Sep 21 12:27 hydqdw
drwxrwxrwx 2 bslops1 dstage 1024 Sep 26 13:46 hydstg

But I want only directory names.Please tell me how to get it.
THANK U VERY MUCH IN ADVANCE
-RAVI KUMAR
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does FTPFile.getName not do what you're looking for?
 
ravi kumar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I want to develop java code to upload files(not through FTP) and I dont want to use third party tool.Any body can please tell me how can I do that?Please send me sample codes if any.
THANKS IN ADVANCE

-Ravi Kumar.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!