-
java版ftp简易客户端(可以获取文件的名称及文件大小)
- package com.ccb.ftp;
-
- import java.io.IOException;
- import java.net.SocketException;
-
- import org.apache.commons.net.ftp.FTPClient;
- import org.apache.commons.net.ftp.FTPFile;
- import org.apache.commons.net.ftp.FTPListParseEngine;
-
- public class FTPClientTool {
-
-
- public static void main(String[] args) {
- FTPClient client = new FTPClient();
- try {
-
- client.connect("192.168.20.21");
-
-
- client.login("admin", "admin");
- System.out.println("login ftp ok ...");
-
-
- String workingDirectory = client.printWorkingDirectory();
- System.out.println(workingDirectory);
-
-
- FTPListParseEngine engine = client.initiateListParsing("/dir1/zenoss-2.4.1-x86.vmware.zip");
- while(engine.hasNext()){
- FTPFile[] files = engine.getNext(5);
- for(int i=0;i<files.length;i++){
-
- System.out.println(files[i].getName());
-
- long size = files[i].getSize();
- System.out.println(size/1024+"kb");
- }
- }
- } catch (SocketException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- }
-
相关阅读:
当前网页调用其他网页
保护自己的网页不被放入框架
保护网页源码
页面的后退、刷新、前进
妙味——拖拽+碰撞+重力
运行代码
妙味——弹性运动
IE css bug及解决方案参考
妙味——布局转换的应用
[LeetCode][JavaScript]Count Complete Tree Nodes
-
原文地址:https://www.cnblogs.com/gyadmin/p/7991453.html
Copyright © 2020-2023
润新知