---
title: "ftp 收集日志文件 windows脚本"
author: "eagletony"
date: "2011-11-29T15:32:36Z"
tags: []
categories: ["行业应用"]
slug: "ftp-windows"
draft: false
lastmod: "2011-11-29T15:32:36Z"
id: 1284049
url: "https://eagletony.iteye.com/blog/1284049"
---

1 定时任务  looptask.bat

@echo off  
setlocal ENABLEDELAYEDEXPANSION  
set /a next\_hour=0  
set /a next\_minute=0  
for /F "tokens=1,2 delims=:" %%i in ('TIME /T') do (  
set /a next\_minute=%%j+5  
set /a next\_hour=%%i  
if !next\_minute! GEQ 60 (  
set /a next\_minute=!next\_minute!-60  
set /a next\_hour=!next\_hour!+1  
if !next\_hour! GEQ 24 set /a next\_hour=!next\_hour!-24  
)  
)  
at !next\_hour!:!next\_minute! "F:\\ftp\\looptask.bat"

at !next\_hour!:!next\_minute! "F:\\ftp\\ftpfiletrans.bat"

endlocal  
@echo on

 

2 ftp 执行脚本命令  ftpfiletrans.bat

 ftp   -i   -s:f:\\ftp\\fscript.txt  

 

3  具体收集日志脚本  fscript.txt

 

open 172.18.0.4    
root  
root  
bin    
put f:\\ftp\\wint.txt    
bye