New
#31
Bingo! That did it. :.)
One last thing... It seems that an SQL log file is bypassing everything. I'll explain...
Here's the code I'm using:
The part about "sqlnet.log" isn't working. I was thinking in my mind that adding that condition would force the batch program to skip over "sqlnet.log", but it's not... Any idea why?Code:@ECHO OFF CLS REM Get today's date FOR /F "tokens=*" %%A IN ('DATE/T') DO FOR %%B IN (%%A) DO SET Today=%%B REM Parse out current Year FOR /F "tokens=1-3 delims=/-" %%A IN ("%Today%") DO ( SET DayMonth=%%A SET MonthDay=%%B SET Year=%%C ) REM Subtract 2 from current year set /a strtyr=%Year%-2 IF NOT EXIST "C:\www\projects\ems\EMS_Batch\ICS Archive\archives" MKDIR "C:\www\projects\ems\EMS_Batch\ICS Archive\archives" FOR %%G IN ("C:\www\projects\ems\EMS_Batch\blah\*.log") DO (call :PARSE "%%~nG") goto:EOF :parse SET filename=%1 if %filename% == "sqlnet.log" (exit /b) IF %filename:~0,24% == %filename% goto found24 REM Process logfiles with 24 char names :found24 REM Skip files that are within current and previous year set /a archive_yn=%strtyr%-%filename:~17,4% if %archive_yn% == -1 goto :EOF if %archive_yn% == -2 goto :EOF set archname=archive_for_card_dumps_%filename:~17,4%.zip REM Add logfile to archive REM Redirection to NUL to suppress messages from 7 zip 7zip a "C:\www\projects\ems\EMS_Batch\ICS Archive\archives\"%archname% "C:\www\projects\ems\EMS_Batch\blah\"%filename%.log > NUL REM Delete logfile after archived, no prompt ECHO Y | DEL "C:\www\projects\ems\EMS_Batch\blah\"%filename%.log goto:EOF
You just want it to skip over sqlnet.log? I'd change the line to:
This should work as well:Code:if %filename% == "sqlnet.log" goto :EOF
Code::parse SET filename=%1 IF %filename:~0,24% == %filename% goto found24 goto :EOF
Excellent! That did it, strollin. Thanks again!