@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 *.*