使用 Passive Mode command line Ftp 上傳資料

因公司備份需要,每天都必須要外點傳備份資料回總公司備查,台北內已有 FileZilla FTP Server, 但這台 Server 放置在防火牆內並僅支援 Passive Mode,原來想採用 Windows FTP 指令來上傳,並上網搜尋到很多資料,發現 Ftp 可以吃一個腳本檔案來模擬執行命令。

其方式如下:

建立一個文字檔案, 裡面包含

—Start here

Open ftp.site.com           << 你的 ftp ip 或 FQDN

Username                       << ftp 帳號

Password                         << ftp 密碼

mput local_filename      <<    上傳指定檔案

bye                                  <<    斷線

—End here

把以上檔案不包含 << 註解存成一個文字檔, 如 Upload.ftp;測試時只要打開 DOS box 打入 ftp –s upload.ftp 就會自動連線上傳檔案。

閱讀全文 使用 Passive Mode command line Ftp 上傳資料