简易ftp工具,简易ftp工具该如何进行连接,在Java环境下如何配置

ftp工具是一种文件传输下载方式,它是TCP/IP协议栈的一部分;其中FTP又由两部分组成,一部分是FTP的服务器,另一部分是FTP的客户端!它能够高效安全地进行文件传输下载操作!可以使用服务器管理工具来作为FTP的客户端,进行FTP的操作,实现FTP的下载安装。所以ftp工具的选择也是很重要的。简易ftp工具该如何进行连接,在Java环境下如何配置,配置教程。

使用工具:IIS7服务器管理工具

IIS7服务器管理工具,ftp工具用于在FTP服务器和FTP客户端之间上传和下载文件,它最优秀的功能就是可以定时上传下载文件,可以定时将文件从一个主机传输到另一个主机。

使用FTP上传工具最优秀的功能就是可以批量管理、批量上传,适用于Windows系统,Linux系统和云服务器等,能极大的提高站长及服务器运维人员工作效率,同时FTP上传工具还是vnc客户端,真正实现了一站式管理,非常方便。

下载地址:IIS7服务器管理工具

image
image

java下配置连接FTP:

public void putTxtToFTP() {

System.out.println("开始执行定时器任务:维系一键订单量!");

Calendar calendar = Calendar.getInstance();

calendar.add(Calendar.DATE, -1); //得到前一天

Date date = calendar.getTime();

SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");

String yesterday = df.format(date);

StringBuffer yjtjOrderTxt = new StringBuffer();

yjtjOrderTxt.append("yjtywx_").append(yesterday).append(".txt");

List<WxActiveData> yjtjOrderList = activeDataService.wxGetYjtjOrder();

//FtpUtil ftpUtil = new FtpUtil("hexin","hx105155","134.64.105.155", "/yjtydd");  //测试库FTP

FtpUtil ftpUtil = new FtpUtil("ahftp","ahdx@#$_123dic","192.168.0.28", "/yjtydd");

PrintWriter printWriter = null;

File highFeeFile = new File(Contants.FILE_PATH_BAK + yjtjOrderTxt);//Contants.FILE_PATH_BAK = "/opt/wss/domains/tmp/"

//      File highFeeFile = new File("D:/" + highFeeTxt);

//      File gjmyFile = new File("D:/" + gjmyTxt);

//File highFeeFile = new File("D:/" + yjtjOrderTxt);

try {

printWriter = new PrintWriter(new FileWriter(highFeeFile, true));

for (int i = 0; i < yjtjOrderList.size(); i++){

printWriter.println(yjtjOrderList.get(i).toString().trim());

}

} catch (IOException e) {

System.out.println("主动服务 高额数据报表任务异常!");

}finally{

printWriter.close();

}

if(highFeeFile.exists()){

System.out.println("主动服务定时器任务 高额数据 上传成功"+yjtjOrderTxt.toString());

ftpUtil.uploadFile(highFeeFile, yjtjOrderTxt.toString());

}else{

System.out.println("主动服务定时器任务 高额数据 上传失败"+yjtjOrderTxt.toString());

}

System.out.println("服务器批量查排名-查询结果");

}

public ActiveDataService getActiveDataService() {

return activeDataService;

}

public void setActiveDataService(ActiveDataService activeDataService) {

this.activeDataService = activeDataService;

}

Java配置方式:

import com.enterprisedt.net.ftp.*;

public class FtpClient {

static FTPClient ftpClient;
public FtpClient(){};
String remoteAddress="192.168.168.33",userName="cattsoft",password="cattsoft";

public void DownLoad(){
try{
FTPClient client = new FTPClient();
client.setRemoteHost(remoteAddress);
client.connect();
client.login(userName,password);
client.setType(FTPTransferType.BINARY);
client.get("E:\\upload\\index.jsp","/home/cattsoft/jakarta-tomcat-5.0.28/webapps/vip/dkf/index2.jsp");
client.quit();
System.out.println("下载成功...");
}catch(Exception e){
e.printStackTrace();
System.out.println("下载失败...");
}

}

public static void main(String[] args){
FtpClient fc = new FtpClient();
fc.DownLoad();
}
}

评论

暂无评论