bat批处理从FTP上下载多文件夹及文件到本地

@echo off
set ftpUser=*****
set ftpPass=*****
set ftpIP=*******
set ftpFolder=portData
set LocalFolder=F:/portData
set Pan=F:\
set AFolder=portData\
set ftpFile=%temp%/TempFTP.txt
for /f "delims=" %%i in (a.txt) do (
echo %%i
set a=%%i
call :first
)
:first
if exist %Pan% (  
    if exist %Pan%%AFolder% (
        echo dir%Pan%%AFolder%exit
    ) else (            
        md %Pan%%AFolder%
    )  
    if exist %Pan%%AFolder%%a% (
        echo dir%Pan%%AFolder%%a%exit
md %Pan%%AFolder%%a%\%date:~0,4%%date:~5,2%%date:~8,2%
    ) else (   
        echo mkdir%Pan%%AFolder%%a%  
        md %Pan%%AFolder%%a% 
md %Pan%%AFolder%%a%\%date:~0,4%%date:~5,2%%date:~8,2%
    )      
) else (  
    echo !!  
    echo !!error no exit %Pan% pan  
    echo !!  
)
>"%ftpFile%" (
  echo,%ftpUser%
  echo,%ftpPass%
  echo cd "%ftpFolder%/%a%/%date:~0,4%%date:~5,2%%date:~8,2%
  echo lcd "%LocalFolder%/%a%/%date:~0,4%%date:~5,2%%date:~8,2%
  echo bin
  echo mget *.txt
  echo bye
)
ftp -v -i -s:"%ftpFile%" %ftpIP%
pause 

你可能感兴趣的:(dos)