Timed ftp, timed ftp tool setting tutorial and configuration in java environment

The IIS7 server management tool has the functions of all server management tools, such as batch management. At the same time, it has many independent research and development functions. Such as synchronization operation, expiration reminder, data security and regular execution. Of course, applicable systems also include Windows and liunx operating systems. Also supports Vnc and Ftp batch operations. There is another very important feature of this software. It is a Chinese software that meets the needs of Chinese users. This is a management tool that cannot be underestimated. Tools are constantly being updated, and developers and technicians are constantly working hard for the majority of users.

Official website portal: http://fwqglgj.iis7.net/cp/ftp/?tscd-zc

Configuration method:

1. Select the ftp window and click FTP settings

2. After entering "FTP Settings"-"Task Settings", let's add tasks first

1. Create a new task (a task can only choose one time period)

1-1: How to set up a day-level scheduled upload or download task

image

1-2: How to set weekly upload or download tasks

image

1-3: How to set up monthly upload or download tasks

image

Note: the choice of backup type

Append: New file.

Modification: New file, or file with modified content.

Overwrite: Overwrite the original file without comparing the file. (Not recommended)

2. Next, choose FTP (the following example timing upload operation tutorial)

2-1: Click "Select FTP"

image

2-2: Enter the FTP binding interface

image

2-3: Successfully bind a ftp site

image

2-4: ftp binding information and task execution results will be displayed at the bottom of the setting interface

image

3. After prompting that the task upload is successful, we go to the corresponding ftp server to check whether the task upload is completed

After checking, the file has been successfully uploaded!

image

Note: This article takes upload as an example, if you need to download, just change the transmission direction to "download"!

The java configuration method is as follows:

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:uploadindex.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();
}
}

Configure connection FTP under java:

public void putTxtToFTP() {

System.out.println("Start timer task: maintain one-click order volume!");

Calendar calendar = Calendar.getInstance();

calendar.add(Calendar.DATE, -1); //Get the previous day

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("Active service high data report task is abnormal!");

}finally{

printWriter.close();

}

if(highFeeFile.exists()){

System.out.println("Successful upload of high amount data of active service timer task"+yjtjOrderTxt.toString());

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

}else{

System.out.println("Active service timer task high amount data upload failed"+yjtjOrderTxt.toString());

}

System.out.println("Server Batch Check Ranking-Query Results");

}

public ActiveDataService getActiveDataService() {

return activeDataService;

}

public void setActiveDataService(ActiveDataService activeDataService) {

this.activeDataService = activeDataService;

}​

Guess you like

Origin blog.51cto.com/14937125/2535926