FTP commands for batch files

http://www.simplescripts.de/ftp-commands-batch-files.htm

FTP batch...

FTP commands for batch files

You can run FTP commands in a batch file with the command

ftp -s:filename

Create a .txt file with the FTP commands, one command per line.

open <hostname>
<FTP user>
<FTP password>
hash                 # display progress
bin                  # copy in binary mode (or asc for Ascii)
lcd <local folder>   # change local directory
cd <remote folder>   # change directory on FTP server
get <remote file>    # copy file to local directory
                                     bye      

Example file download_logfiles.txt:

open www.mydomain.com
john
moNkey77
hash
asc
lcd c:\temp
cd statistics/logs
get access_log
bye

Now you can start the download from the command line with the following command:

ftp -s:download_logfiles.txt



Check the FTP port in regular intervals

If you would like to check your FTP Server at regular intervals, you can use the command line utility SLCheck. SLCheck connects to the FTP Server and checks the answer. Batch files can be executed in dependance of the result, e.g. to send alarm notifications. Try the following command:

SLCheck -p 21 -a ftp.domain.com -r "220 ProFTPD"

220 ProFTPD
can be the normal answer from a FTP Server.

All results are logged in a logfile. You can monitor your FTP Server by running SLCheck as a scheduled task, e.g. once a minute.

SLCheck Homepage

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值