where to find a FTP Class

B

Baby Lion

Hi All,
I am having a project of FTP searching ,
and I am doing crawling ftp part,
so I need a FTP class , to list files in Ftp .

Is there anybody who can tell where to get such a FTP Class?

I just tried org.apache.commons.net.ftp , but it has some bug .

Thanks a lot for your help
 
E

Ed Webb

Baby said:
Hi All,
I am having a project of FTP searching ,
and I am doing crawling ftp part,
so I need a FTP class , to list files in Ftp .

Is there anybody who can tell where to get such a FTP Class?

I just tried org.apache.commons.net.ftp , but it has some bug .

That a pretty brave claim.
More likely you are not using it correctly.
Thanks a lot for your help

Try this link. It's from 2003 but it gives you somewhere to start from.

http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html

Ed!
 
B

Baby Lion

Definitely there is a bug there !
I list the dir("/pub/Music/MP3/Songs/English/Male/Mario Winans/")
on server ftp.trueice.net
and it give me the result of listing
"/pub/Music/MP3/Songs/English/Male/Mario/"

Ed Webb 写é“:
 
E

Ed Webb

Ed Webb 写é“:
Baby said:
> Definitely there is a bug there !
> I list the dir("/pub/Music/MP3/Songs/English/Male/Mario Winans/")
> on server ftp.trueice.net
> and it give me the result of listing
> "/pub/Music/MP3/Songs/English/Male/Mario/"
>

My first reaction on seeing this is that there really should not be that
space in your url. Have you tried:

"/pub/Music/MP3/Songs/English/Male/Mario+Winans/"

"/pub/Music/MP3/Songs/English/Male/Mario%20Winans/"

Just a thought.

Ed!
 
B

Baby Lion

I tried this, it's no use
And it seems ftp is different from http, it doesn't need Encoding
Ed Webb 写é“:
 
R

rc

Baby said:
Definitely there is a bug there !
I list the dir("/pub/Music/MP3/Songs/English/Male/Mario Winans/")
on server ftp.trueice.net
and it give me the result of listing
"/pub/Music/MP3/Songs/English/Male/Mario/"

Hmm strange, I just tried this and it works for me. On the server I
have:

rc@zulu:~/x/with space $ ls -l
total 0
-rw-rw-r-- 1 rc rc 0 Oct 3 00:40 file1.txt
-rw-rw-r-- 1 rc rc 0 Oct 3 00:40 file2.txt

Client:
rc@salchicha:~/stp/jcn/commons-net-1.4.1 $ cat FtpTest.java
import org.apache.commons.net.ftp.*;

class FtpTest {

public static void main (String [] args) throws Exception{
FTPClient f = new FTPClient();
f.connect("ftp.foo.ch");
f.login("rc", "xxxx");
String dir = "x/with space";
if (f.changeWorkingDirectory(dir)){
System.out.println("Contents of dir " + dir);
String [] names = f.listNames();

for (int i = 0; i < names.length; i++ ){
System.out.println(names);
}
}else{
System.out.println("Failed to change to dir " + dir);
}

}
}

rc@salchicha:~/stp/jcn/commons-net-1.4.1 $ javac FtpTest.java && java
FtpTest
Contents of dir x/with space
file1.txt
file2.txt

This is with commons-net 1.4.1, remote server is Proftpd on Linux.
Maybe you use an old version of the library. Also, if any quoting is
required, I'd rather try "'/pub/Music/MP3/Songs/English/Male/Mario
Winans/'"(single quotes around path) or
"/pub/Music/MP3/Songs/English/Male/Mario\\ Winans/", though neither of
it worked for me.

Good luck.
 
C

Chris Uppal

rc said:
Hmm strange, I just tried this and it works for me.

I suspect that the problem may be with the server, not the client. There is
nothing in the FTP spec to say that filenames (or directory names) should be
quoted, and no defined mechanism for doing so. So, as far as I can see, the
client should just send the request without quotes. However, if the server
is -- for some mysterious reason -- interpreting blanks in the request then it
will not be happy.

If he OP can list that directory on that server using a different client, but
not with the Apache client, then it would be interesting to put a network
sniffer on the requests and see what was different. It may be that another
client has special code to recognise, and correct for, broken servers.

(Unfortunately, I can't access the OP's example server myself -- I just get
timeouts.)

-- chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top