import java.io.*;
import sun.net.ftp.FtpClient;public class Application1 {public static void main(String args[]) throws Exception {FtpClient fc;String host = "202.145.xxx.xxx";String path = "";
String username = "user";
String password = "name";FtpClient client = new FtpClient(host);
client.login(username, password);
client.binary();
client.cd(".");//这里是设置相对于host主目录的子目录DataInputStream dis =new DataInputStream(client.list());
int readCount;
String s="";
while((s=dis.readLine())!=null) {
if(s.toUpperCase().endsWith(".TXT"))
System.out.println("Getting: " + s);
}
}
}
import sun.net.ftp.FtpClient;public class Application1 {public static void main(String args[]) throws Exception {FtpClient fc;String host = "202.145.xxx.xxx";String path = "";
String username = "user";
String password = "name";FtpClient client = new FtpClient(host);
client.login(username, password);
client.binary();
client.cd(".");//这里是设置相对于host主目录的子目录DataInputStream dis =new DataInputStream(client.list());
int readCount;
String s="";
while((s=dis.readLine())!=null) {
if(s.toUpperCase().endsWith(".TXT"))
System.out.println("Getting: " + s);
}
}
}
解决方案 »
- new TreeSet<String>(comparator) 不带有参数?这是什么意思呃。谢谢。
- socket实现文件断点续传
- 好的JAVA/C++视频谁有?提供一下,以前有的就不要提了哈!散分
- 【在线高分求解】用resultSet.getString读数据库里Varchar(2000)的字段,为什么只能读出255字符?有什么方法可以解决?谢谢
- 静态方法没有被执行,为什么??
- 不好意思 这个java specification指的是什么
- applet在网页中实现资源管理器,能实现吗?
- TimerTask嵌套调用问题。
- jbuilder7配置
- 我的本地化方法怎么不能运行,
- 如何复制一个ZIP文件到一个新的路径下啊?在线等
- 送分的新手
DataInputStream dis =new DataInputStream(client.list());
-->
DataInputStream dis =new DataInputStream(client.nameList("."));
import java.io.*;
import sun.net.ftp.FtpClient;
import java.util.StringTokenizer;public class Application1 {public static void main(String args[]) throws Exception {FtpClient fc;String host = "172.18.25.211";String path = "";
String username = "xiruo";
String password = "xiruojiang";FtpClient client = new FtpClient(host);
client.login(username, password);
client.binary();
client.cd(".");//这里是设置相对于host主目录的子目录//DataInputStream dis =new DataInputStream(client.list());
BufferedReader dr = new BufferedReader(new InputStreamReader(client.list()));
int readCount;
String s="";
String filename="";
while((s=dr.readLine())!=null) {
if((filename=a(s)).toUpperCase().endsWith(".TXT"))
System.out.println(filename);
}
}public static String a(String s) {
String s1="";
StringTokenizer st=new StringTokenizer(s," ");
s1=st.nextToken();
while(st.hasMoreTokens())
s=st.nextToken();
return s1.indexOf("-")==-1?"Folder:"+s:"File:"+s;
}
}