java ftp 怎么建立多层文件夹

如题所述

第1个回答  2012-07-17
public static void buildList(FtpClient aftp,String pathList) throws Exception {
aftp.ascii();
StringTokenizer s = new StringTokenizer(pathList, "/"); //sign
int count = s.countTokens();
String pathName = "";
while (s.hasMoreElements()) {
pathName = pathName + "/" + (String) s.nextElement();
try {
aftp.sendServer("XMKD " + pathName + "\r\n"); }
catch (Exception e) { e.printStackTrace(); }
int reply = aftp.readServerResponse(); }
aftp.binary();
}
第2个回答  2012-07-18
楼上说的对
第3个回答  2012-07-17
你是说java 链接ftp服务器吗
可以调用java执行命令的api
执行mkdir命令
多级目录价格-p参数
mkdir -p a/b/c 这样本回答被网友采纳
相似回答