在FTP服务器上创建目录

来源:互联网 发布:js获取元素的方法 编辑:程序博客网 时间:2024/05/21 09:27

public class Mkdir extends FtpClient {
 public Mkdir() {
  super();
 }

 public void mkd() {
  String cmd = "MKD " + "071212";
  boolean flag=true;
  try {
   this.openServer("10.1.1.11");
   this.login("ess", "ess");// 登陆FTP服务器用户名密码
   this.cd("/ess713/ccdss/input");
   BufferedReader dr = new BufferedReader(new InputStreamReader(this
     .list()));
   String s = "";
   dr.readLine();
   while ((s = dr.readLine()) != null) {
    if(s.substring(s.length()-6).equals("071212"))
    {
     flag=false;
    }
   }
   System.out.println(flag);
   if(flag)
   {
   this.issueCommandCheck(cmd);
   }
   else
   {
    System.out.println("目录已存在!!!");
   }
  } catch (IOException e) {
   e.printStackTrace();
  }
 }
 public static void main(String args[]) throws IOException {
  Mkdir mk = new Mkdir();
  mk.mkd();
 }