How to set script below that use yestarday date (date -1day)?
FOR /F "tokens=2-4delims=. " %%A IN ("%date%") DO (
SET day=%%A
SET month=%%B
SET year=%%C
)
echo FMS_%year%%month%%day%*.txt
echo. ------------------------------------------------------
echo %date% %time% Downloading file from server1
wget --ftp-user=%username1% --ftp-password=%password1% ftp://%server_name1%/%remote_directory1%/FMS_%year%%month%%day%*.txt
(
echo open %server_name2%
echo %username2%
echo %password2%
echo binary
echo cd %remote_directory2%
echo put FMS_%year%%month%%day%*.txt
echo quit
)>list2.ftp
FTP -i -s:list2.ftp
del FMS_%year%%month%%day%*.txt
get date 1 day ago
Moderator: DosItHelp
Re: get date 1 day ago
Code: Select all
@echo off
:: date yesterday (-1) or any number
set day=-1
(
echo s=DateAdd("d",%day%,now^) : d1=Cstr(weekday(s^)^) : d2=WeekdayName(d1,0^)
echo WScript.Echo Cstr(year(s^)^)+" "+Cstr(right(100+month(s^),2^)^)+" "+Cstr(right(100+day(s^),2^)^)+" "+d1+" "+d2
)>"%temp%\%~n0.vbs"
for /f "tokens=1-5" %%a in ('cscript /nologo "%temp%\%~n0.vbs"') do set "YYYY=%%a" & set "MM=%%b" & set "DD=%%c" & set "daynum=%%d" & set "weekday=%%e"
del "%temp%\%~n0.vbs"
set "newdate=%YYYY%%MM%%DD%"
echo Using the day offset of %day% it was "%newdate%" at that time,
echo and day number=%daynum% (%weekday%)
pause