File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes Open Source FTP Java client - Problems getting directory listing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "Open Source FTP Java client - Problems getting directory listing" Watch "Open Source FTP Java client - Problems getting directory listing" New topic
Author

Open Source FTP Java client - Problems getting directory listing

MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
Hi, my knowledge of FTP in general is quite limited so bear with me.

I have gone through 3 different open source scripts now, and each one, I get the same problem. It connects to the ftp folder fine, but cannot get the directory listing. It either times out or returns nothing.

At the moment I am using this - http://www.enterprisedt.com/products/edtftpj/

Basically, what I need to do, is connect to a predesignated ftp folder and download everything from there, to my local machine. Pretty simple. But edtftpj connects fine then when using FTPFile[] files = ftp.directoryList(); it times out.

I have a feeling it is to do with the ftp server i'm connnecting to, but I dont know enough. Does anyone have any ideas?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Michael,

Have you tried Apache commons-net? And yes the type of FTP server does matter, there are some subtleties between them and often you have to configure your FTP lib to talk to a particular flavour. _very_ rarely you have to write a plugin to make yours work.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
Martijn Verburg wrote:Hi Michael,

Have you tried Apache commons-net? And yes the type of FTP server does matter, there are some subtleties between them and often you have to configure your FTP lib to talk to a particular flavour. _very_ rarely you have to write a plugin to make yours work.


Fantastic, thanks for your response. I have only been given the host, username and password for the FTP folder. But I can get more information regarding the folder if I know what to ask for... problem is, I dont know what to ask :P

What kinda things do i, or can I find out about it to get a better idea of what I need to use?
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

You'll want to find out the host OS of the FTP server, that's usually enough to configure your client correctly. Also I assume you've logged in through a Command Line client to check your permissions, home directory etc are OK?
MichaelJ McCabe
Ranch Hand

Joined: Feb 09, 2010
Posts: 49
Martijn Verburg wrote:You'll want to find out the host OS of the FTP server, that's usually enough to configure your client correctly. Also I assume you've logged in through a Command Line client to check your permissions, home directory etc are OK?


I know the host OS as Windows NT, but dont see how that would affect it. I logged in through command line using the username and password provided. And when listing the directory, it shows the files in the folder using ASCII mode data connection. So I know that works...
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

It being windows might make all the difference . Also what FTP server are they using? The Windows NT native one or a 3rd party? Check out Apache Commons Net documentation on connecting to the different types of servers...
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Almost forgot, very important! Check setting active vs passive mode on the connection
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Open Source FTP Java client - Problems getting directory listing