//ftp.makeDirectory(path);// 这个方法不会改变当前工作目录 //保证可以创建多层目录 StringTokenizer s = new StringTokenizer(path, "/"); s.countTokens(); String pathName = ""; while (s.hasMoreElements()) { pathName = pathName + "/" + (String) s.nextElement(); try { ftp.mkd(pathName); } catch (Exception e) { log.info("ftp文件夹创建失败"); } }