@echo off
rem 指定FTP用户名
set ftpUser=FTPUSERNAME
rem 指定FTP密码
set ftpPass=FTPPASSWORD
rem 指定FTP服务器地址
set ftpIP=192.168.0.2
设置待上传的本地文件夹目录
set SrcFolder=C:/test
dir /b /aa-d>nul 2>nul
if %errorlevel% equ 1 (
echo No archiving file to FTP
pause
goto :eof
)
set FtpFile=%temp%/TempFTP.txt
>"%FtpFile%" echo,%ftpUser%
>>"%FtpFile%" echo,%ftpPass%
>>"%FtpFile%" echo bin
for /f "tokens=*" %%a in ('dir /b /aa-d') do (
>>"%FtpFile%" echo put "%SrcFolder%/%%a"
)
>>"%FtpFile%" echo bye
start ftp -v -i -s:"%FtpFile%" %ftpIP%
ping -n 10 127.1>nul
attrib -a *.*