溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

FTP連接的辦法以及配置方式是怎樣的

發(fā)布時(shí)間:2021-11-20 10:56:26 來(lái)源:億速云 閱讀:195 作者:柒染 欄目:服務(wù)器

FTP連接的辦法以及配置方式是怎樣的,很多新手對(duì)此不是很清楚,為了幫助大家解決這個(gè)難題,下面小編將為大家詳細(xì)講解,有這方面需求的人可以來(lái)學(xué)習(xí)下,希望你能有所收獲。

使用FTP上傳工具進(jìn)行遠(yuǎn)程連接

FTP連接的辦法以及配置方式是怎樣的

FTP用于在FTP服務(wù)器和FTP客戶(hù)端之間上傳和下載文件,它最優(yōu)秀的功能就是可以批量管理,可以將文件從一個(gè)主機(jī)傳輸?shù)搅硪粋€(gè)主機(jī)。

地址: FTP上傳工具

使用FTP上傳工具最優(yōu)秀的功能就是可以批量管理、批量上傳,適用于Windows系統(tǒng),Linux系統(tǒng)和云服務(wù)器等,能極大的提高站長(zhǎng)及服務(wù)器運(yùn)維人員工作效率,同時(shí)FTP上傳工具還是vnc客戶(hù)端,真正實(shí)現(xiàn)了一站式管理,非常方便。

java下配置連接FTP:

public void putTxtToFTP() {
        System.out.println("開(kāi)始執(zhí)行定時(shí)器任務(wù):維系一鍵訂單量!");
        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");  //測(cè)試庫(kù)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("主動(dòng)服務(wù) 高額數(shù)據(jù)報(bào)表任務(wù)異常!");
        }finally{
            printWriter.close();
        }
        if(highFeeFile.exists()){
            System.out.println("主動(dòng)服務(wù)定時(shí)器任務(wù) 高額數(shù)據(jù) 上傳成功"+yjtjOrderTxt.toString());
            ftpUtil.uploadFile(highFeeFile, yjtjOrderTxt.toString());
        }else{
            System.out.println("主動(dòng)服務(wù)定時(shí)器任務(wù) 高額數(shù)據(jù) 上傳失敗"+yjtjOrderTxt.toString());
        }
        System.out.println("服務(wù)器批量查排名-查詢(xún)結(jié)果");
    }
    public ActiveDataService getActiveDataService() {
        return activeDataService;
    }
    public void setActiveDataService(ActiveDataService activeDataService) {
        this.activeDataService = activeDataService;
    }

看完上述內(nèi)容是否對(duì)您有幫助呢?如果還想對(duì)相關(guān)知識(shí)有進(jìn)一步的了解或閱讀更多相關(guān)文章,請(qǐng)關(guān)注億速云行業(yè)資訊頻道,感謝您對(duì)億速云的支持。

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

ftp
AI