Advertisement
mike2545

wget

Nov 3rd, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 1.97 KB | None | 0 0
  1.  @echo OFF
  2.    IF %1/==:/ GOTO %2
  3.    IF NOT %1/==/?/ GOTO Begin
  4.    echo Parses the current date.
  5.    echo.
  6.    echo [CALL] NewDate
  7.    echo.
  8.    echo NewDate sets the following variables:
  9.    echo.
  10.    echo   Day of Week : DOW
  11.    echo   Day         : DD
  12.    echo   Month       : MM
  13.    echo   Year        : YYYY
  14.    echo.
  15.    echo NewDate supports the following date formats:
  16.    echo.
  17.    echo   MM-DD-YYYY  DD-MM-YYYY  DD.MM.YYYY  DD/MM/YYYY
  18.    FOR %%C in (echo. GOTO:END) DO %%C
  19.   :Begin --------------------------------------------------------------
  20.    echo. | date | FIND "(mm" > NUL
  21.    IF NOT errorlevel 1 %0 : %OS%Parse MM DD
  22.                        %0 : %OS%Parse DD MM
  23.   :Windows_NTParse ----------------------------------------------------
  24.    FOR /F "tokens=1-4 delims=/.- " %%A in ('date /T') do if %%D!==! (
  25.      set %3=%%A&set %4=%%B&set YYYY=%%C
  26.    ) ELSE (
  27.      set DOW=%%A&set %3=%%B&set %4=%%C&set YYYY=%%D)
  28.    GOTO END
  29.   :Parse --------------------------------------------------------------
  30.    FOR %%C in (md cd) DO %%C @tmp@
  31.    echo @prompt set _D=$D$_> ~tmp1.bat
  32.    %COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
  33.    CALL ~tmp2
  34.    echo %_D% | FIND "/" > NUL
  35.    IF NOT errorlevel 1 GOTO Slash
  36.    lfnfor ON > "%_D%.-"
  37.    ren "%_D%.-" "??? ?? ?? ????"
  38.    FOR %%F in ("??? ?? ?? ????") DO set _D=%%F
  39.    lfnfor OFF
  40.   :Slash
  41.    echo set DOW=%%%3%%>~tmp1.bat
  42.    FOR %%S in ("%3=%%%4%%" "%4=%%YYYY%%" "YYYY=%%1") DO echo set %%S>>~tmp1.bat
  43.    FOR %%S in (%_D%) DO CALL ~tmp1 %%S
  44.    echo %_D% | FIND "/" > NUL
  45.    IF errorlevel 1 GOTO Cleanup
  46.    echo @prompt set %4=$%%%4%%$_set YYYY=$%YYYY%$_ > ~tmp1.bat
  47.    %COMSPEC% /e:2048 /c ~tmp1.bat > ~tmp2.bat
  48.    CALL ~tmp2
  49.   :Cleanup
  50.    FOR %%C in ("set _D=" cd.. "deltree /y @tmp@ > NUL") DO %%C
  51.   :END ----------------------------------------------------------------
  52.    set filename=%YYYY%-%MM%-%DD%
  53. @echo %filename%
  54. cd c:\Sunnydata
  55. del /q c:\sunnydata\*.*
  56. "wget" ftp://user:577@192.168.0.168/DATA/%YYYY%/%filename%.csv
  57. cd \
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement