如題:
現在的情況是,我需要在FTP服務器上做這樣的操作:A文件夾移動到 B文件夾的子目錄..
看了網上說的用rename移動,根本不行,有經驗的大哥大姐們,支個招..
問題已解決: 感謝 "不是阿爾伯特" 的指點..
private static String downLoadPath = "/主文件/";
String tempStr = fNames[i];
String simpleName = tempStr.substring(0,tempStr.lastIndexOf("."));
String movePath = "";
if(typeCode.equals("0")){
movePath = FTP_ORDER;
}else if(typeCode.equals("1")){
movePath = FTP_TAXBILL;
}else if(typeCode.equals("2")){
movePath = FTP_WAYBILL;
}else if(typeCode.equals("3")){
movePath = FTP_GOODS;
}
String oldName = downLoadPath+simpleName+".xml";
String newName = movePath+simpleName+"2a.xml";
logger.info(oldName);
logger.info(newName);
boolean bools = ftp.changeWorkingDirectory(downLoadPath);
logger.info(bools);
// boolean bool = ftp.rename("a.txt","b");
int RNFR = ftp.sendCommand(FTPCmd.RNFR,oldName);
int RANTO = ftp.sendCommand(FTPCmd.RNTO,newName);
logger.info(RNFR +"\t"+ RANTO);