* @throws Exception
*/
public static void main(String[] args) throws Exception {
FtpUploadSound_1 fUp = new FtpUploadSound_1("172.16.0.142", 22, "ivr", "ivr");
fUp.login();
/*
* fUp.buildList("/adfadsg/sfsdfd/cc"); String destination =
* "/test/SetupDJ.rar"; fUp.upFile( "C:\\Documents and
* Settings\\Administrator\\My Documents\\SetupDJ.rar", destination);
* ArrayList filename = fUp.fileNames("/"); for (int i = 0; i <
* filename.size(); i++) {
* System.out.println(filename.get(i).toString()); }
*
* fUp.downFile("/sample.zip", "d:\\sample.zip");
*/
FileInputStream fin = new FileInputStream("d:\\wapPush.txt");
byte[] data = new byte[20480000];
fin.read(data, 0, data.length);
fUp.upFile(data, "/home/cdr/wapPush.txt");
fUp.logout();
System.out.println("程序运行完成!");
/*
* 在服务器上执行命令,如果用sendServer来执行远程命令(不能执行本地FTP命令)的话,所有FTP命令都要加上\r\n
* ftpclient.sendServer("XMKD /test/bb\r\n"); //执行服务器上的FTP命令
* ftpclient.readServerResponse一定要在sendServer后调用
* nameList("/test")获取指目录下的文件列表XMKD建立目录,当目录存在的情况下再次创建目录时报错XRMD删除目录
* DELE删除文件
*/
}
}
摘自 whf_08