For /f “tokens=1-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c%%b%%a)
set files=%mydate%_ResumoOperacoes_0.XML
echo wscript.Echo dateadd(“d”, -1, now()) > “%temp%\yesterday.vbs”
for /F “tokens=1-4 delims=/ ” %%a in (‘cscript //nologo “%temp%\yesterday.vbs”‘) do (set mydate=%%c%%b%%a)
set files2=%mydate%_ResumoOperacoes_0.XML
echo %files2%
echo wscript.Echo dateadd(“d”, -2, now()) > “%temp%\yesterday.vbs”
for /F “tokens=1-4 delims=/ ” %%a in (‘cscript //nologo “%temp%\yesterday.vbs”‘) do (set mydate=%%c%%b%%a)
set files3=%mydate%_ResumoOperacoes_0.XML
echo %files3%
echo wscript.Echo dateadd(“d”, -3, now()) > “%temp%\yesterday.vbs”
for /F “tokens=1-4 delims=/ ” %%a in (‘cscript //nologo “%temp%\yesterday.vbs”‘) do (set mydate=%%c%%b%%a)
set files4=%mydate%_ResumoOperacoes_0.XML
echo %files4%
echo open ftp.meudominio.com.br> C:\FTP\conf\ftprun.txt
echo usuario>> C:\FTP\conf\ftprun.txt
echo senha>> C:\FTP\conf\ftprun.txt
echo hash>> C:\FTP\conf\ftprun.txt
echo asc>> C:\FTP\conf\ftprun.txt
echo lcd C:\FTP\dados>> C:\FTP\conf\ftprun.txt
echo mget %files%>> C:\FTP\conf\ftprun.txt
echo mget %files2%>> C:\FTP\conf\ftprun.txt
echo mget %files3%>> C:\FTP\conf\ftprun.txt
echo mget %files4%>> C:\FTP\conf\ftprun.txt
echo disconnect>> C:\FTP\conf\ftprun.txt
echo bye>> C:\FTP\conf\ftprun.txt
ftp -i -s:C:\FTP\conf\ftprun.txt
For /f “tokens=1-4 delims=/ ” %%a in (‘date /t’) do (set mydate=%%c%%b%%a)
echo %mydate%_%TIME%>>C:\FTP\conf\rodei.txt
del C:\FTP\conf\ftprun.txt
del “%temp%\yesterday.vbs”