URLConnection FTP list files

后端 未结 3 1296
抹茶落季
抹茶落季 2020-12-11 04:09
URL url =  new URL(\"ftp://user:pass@ftp.example.com/thefolder/\");
URLConnection connection = url.openConnection();
...
// List files in folder...

3条回答
  •  时光取名叫无心
    2020-12-11 04:53

    Check out this class I found. It's does the lifting for you. Class at nsftools.com

    Example would be:

    FTPConnection ftpConnect = new FTPConnection();
    ftpConnect.connect("ftp.example.com");
    ftpConnect.login("user","pass");
    
    System.out.println(ftpConnect.listFiles());
    

提交回复
热议问题