StanislavG
Junior Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Elroir У меня проблема что может быть первого числа не собираються файлы: rem @echo off rem start %time% setlocal set "dt=%date%" FOR %%I IN (*.old,*.rsa,*.ind,*.key,*.pud,*.rsa,*.lo1,*.er1,*.err,*.nbu,*.pub,*.new,*.log) DO call :finddate "%%I" %dt:~0,2% %dt:~3,2% %dt:~6,4% c:\tcpfoss.452\log\*.nbu c:\tcpfoss.452\jnin\test\ arj a c:\tcpfoss.452\jnin\jour%prevm%.arj c:\tcpfoss.452\log\*.nbu move c:\tcpfoss.452\log\*.nbu w:\nbumail\journal rem cd w:\nbumail\journal REM arj32 m w:\nbumail\journal\jour%prevd%%prevm%.dh0 w:\nbumail\journal\ *.old *.rsa *.ind *.key *.pud *.rsa *.lo1 *.er1 *.err *.nbu *.pub *.new *.log goto :EOF :finddate for /F "usebackq tokens=1,2,3,4 delims=. " %%A IN (`"dir /T:C %1 | find %1"`) DO call :test %%A %%B %%C %1 %2 %3 %4 goto :EOF :test rem File's date set "fd=%1" set "fm=%2" set "fy=%3" rem Get rid of leeding zero if %fd% LSS 10 set "fd=%fd:~-1%" rem if %fm% LSS 10 set "fm=%fm:~-1%" rem if %fy% LSS 10 set "fm=%fy:~-1%" rem Current date set "curd=%5" set "curm=%6" set "cury=%7" rem Get rid of leeding zero if %curd% LSS 10 set "curd=%curd:~-1%" rem if %curm% LSS 10 set "curm=%curm:~-1%" rem if %cury% LSS 10 set "cury=%cury:~-1%" set /a "prevd=%curd%-1" set "prevm=%curm%" set "prevy=%cury%" set "prevye=%cury%" if %curm%==12 ( set "prevme=11"& set "days=30") if %curm%==11 ( set "prevme=10"& set "days=31") if %curm%==10 ( set "prevme=9"& set "days=30") if %curm%==9 ( set "prevme=8"& set "days=31") if %curm%==8 ( set "prevme=7"& set "days=31") if %curm%==7 ( set "prevme=6"& set "days=30") if %curm%==6 ( set "prevme=5"& set "days=31") if %curm%==5 ( set "prevme=4"& set "days=30") if %curm%==4 ( set "prevme=3"& set "days=31") if %curm%==3 ( set "prevme=2"& set "days=28") if %curm%==2 ( set "prevme=1"& set "days=31") if %curm%==1 ( set "prevme=12"& set "days=31"& set /a "prevye=%prevy%-1") if %prevd% LEQ 0 ( set /a "prevd=%days%+%prevd%" set "prevm=%prevme%" set "prevy=%prevye%") set "match=true" if not "%fd%"=="%prevd%" ( set "match=false") if not "%fm%"=="%prevm%" ( set "match=false") if not "%fy%"=="%prevy%" ( set "match=false") if "%match%"=="true" ( copy c:\tcpfoss.452\%4 c:\tcpfoss.452\jnin\test\ arj a c:\tcpfoss.452\jnin\jour%prevm%.arj c:\tcpfoss.452\%~4 c:\tcpfoss.452\log\*.nbu c:\tcpfoss.452\jnin\test\ arj a c:\tcpfoss.452\jnin\jour%prevm%.arj c:\tcpfoss.452\log\*.nbu move c:\tcpfoss.452\%4 w:\nbumail\journal move c:\tcpfoss.452\log\*.nbu w:\nbumail\journal) |