ftp上传、下载、删除代码.zip
代码说明:
package com.ftp; /**ftp上传、下载、删除文件测试类*/ public class test { public static void main(String[] args) { test test = new test(); //ftp上传 test.uploadFile(".../data/user/FileTxt/", "D:/test/uploadFile/test.txt");//测试通过,ok! //ftp下载 test.downFile(".../data/user/FileTxt/hfufd-jh15fd-54fd8-sds.txt", "D:/test/downFile/");//测试通过,ok! /**(true代表删除指定目录(慎用),false代表删除指定文件)个人建议一般使用false*/ //ftp删除文件 test.deleteFile(".../data/user/FileTxt/1ca48ef6-1116-419c-b267-59edd944502e.txt", false);//测试通过,ok! //ftp删除目录 test.deleteFile(".../data/user/FileTxt/", true);//测试通过,ok! } /** * ftp上传 * @param remotePath (服务器目录地址) * @param localPath (本地文件地址) * @return boolean */ public String uploadFile(String remotePath,String localPath) { System.out.println("上传方法开始...!"); String path = new FtpUploading().uploadFile(remotePath, localPath); if(Util.isNotEmpty(path)){ System.out.println("上传成功!服务器文件的地址为:re
下载说明:请别用迅雷下载,失败请重下,重下不扣分!


