Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo OFF
- IF %1/==:/ GOTO %2
- IF NOT %1/==/?/ GOTO Begin
- echo Parses the current date.
- echo.
- echo [CALL] NewDate
- echo.
- echo NewDate sets the following variables:
- echo.
- echo Day of Week : DOW
- echo Day : DD
- echo Month : MM
- echo Year : YYYY
- echo.
- echo NewDate supports the following date formats:
- echo.
- echo MM-DD-YYYY DD-MM-YYYY DD.MM.YYYY DD/MM/YYYY
- FOR %%C in (echo. GOTO:END) DO %%C
- :Begin --------------------------------------------------------------
- echo. | date | FIND "(mm" > NUL
- IF NOT errorlevel 1 %0 : %OS%Parse MM DD
- %0 : %OS%Parse DD MM
- :Windows_NTParse ----------------------------------------------------
- FOR /F "tokens=1-4 delims=/.- " %%A in ('date /T') do if %%D!==! (
- set %3=%%A&set %4=%%B&set YYYY=%%C
- ) ELSE (
- set DOW=%%A&set %3=%%B&set %4=%%C&set YYYY=%%D)
- GOTO END
- :Parse --------------------------------------------------------------
- FOR %%C in (md cd) DO %%C @tmp@
- echo @prompt set _D=$D$_> ~tmp1.bat
- %COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
- CALL ~tmp2
- echo %_D% | FIND "/" > NUL
- IF NOT errorlevel 1 GOTO Slash
- lfnfor ON > "%_D%.-"
- ren "%_D%.-" "??? ?? ?? ????"
- FOR %%F in ("??? ?? ?? ????") DO set _D=%%F
- lfnfor OFF
- :Slash
- echo set DOW=%%%3%%>~tmp1.bat
- FOR %%S in ("%3=%%%4%%" "%4=%%YYYY%%" "YYYY=%%1") DO echo set %%S>>~tmp1.bat
- FOR %%S in (%_D%) DO CALL ~tmp1 %%S
- echo %_D% | FIND "/" > NUL
- IF errorlevel 1 GOTO Cleanup
- echo @prompt set %4=$%%%4%%$_set YYYY=$%YYYY%$_ > ~tmp1.bat
- %COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
- CALL ~tmp2
- :Cleanup
- FOR %%C in ("set _D=" cd.. "deltree /y @tmp@ > NUL") DO %%C
- :END ----------------------------------------------------------------
- set filename=%YYYY%-%MM%-%DD%
- @echo %filename%
- cd c:\Sunnydata
- del /q c:\sunnydata\*.*
- "wget" ftp://user:577@192.168.0.168/DATA/%YYYY%/%filename%.csv
- cd \
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement