Apache Commons FTPClient.listFiles

Apache Commons FTPClient.listFiles,第1张

Apache Commons FTPClient.listFiles

问题是您想在连接之后但在登录之前进入被动模式。您的代码对我没有任何回报,但这对我有用:

import org.apache.commons.net.ftp.FTPClient;import java.io.IOException;import org.apache.commons.net.ftp.FTPFile;public class BasicFTP {    public static void main(String[] args) throws IOException {        FTPClient client = new FTPClient();        client.connect("c64.rulez.org");        client.enterLocalPassiveMode();        client.login("anonymous", "");        FTPFile[] files = client.listFiles("/pub");        for (FTPFile file : files) { System.out.println(file.getName());        }    }}

给我这个输出

c128c64c64.huincomingplus4


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5500688.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-13

发表评论

登录后才能评论

评论列表(0条)

保存