-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReadMxdTest.bat
66 lines (57 loc) · 1.47 KB
/
ReadMxdTest.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
@echo off
set READMXD=d:\Projects\ReadMxd\dist\ReadMxdW.exe
set TESTDIR=c:\temp\ReadMxdTest
set LOGFILE=%TESTDIR%\_results.txt
if exist %TESTDIR% (rmdir %TESTDIR% /s)
mkdir %TESTDIR%
pushd %TESTDIR%
echo Starting ReadMxd test at %DATE% %TIME%> %LOGFILE%
call :searchFolder d:\maps
call :searchFolder C:\Users\jpm\Documents\ArcGIS
:: check for errors etc ::
set TESTDIR=/%TESTDIR:\=/%
set TESTDIR=%TESTDIR::=%
call grep -Hi error %TESTDIR%/*.log >> %LOGFILE%
call grep -Hi warning %TESTDIR%/*.log >> %LOGFILE%
call grep -Hi unknown %TESTDIR%/*.log >> %LOGFILE%
call grep -Hi -B1 todo %TESTDIR%/*.log >> %LOGFILE%
call grep -Hi System.__ComObject %TESTDIR%/*.log >> %LOGFILE%
echo Done at %DATE% %TIME%>> %LOGFILE%
popd
echo OK
set TESTDIR=
set READMXD=
set LOGFILE=
goto :eof
:searchFolder
setlocal
echo Searching %1.
call :searchForType %1 mxd
call :searchForType %1 lyr
for /f "tokens=*" %%a in ('dir %1 /ad/b') do (
call :searchFolder "%~1\%%~a"
)
endlocal
goto :eof
:searchForType
setlocal
if not exist %1\*.%2 goto :eof
for /f "tokens=*" %%a in ('dir %1\*.%2 /b') do (
echo %%a
set LOGNAME=%%a
if /i "%2" equ "mxd" (
set LOGNAME=!LOGNAME:.mxd=_props.log!
) else (
set LOGNAME=!LOGNAME:.=_!_props.log
)
if exist %TESTDIR%\!LOGNAME! (
for /f %%t in ('GetDateStamp.bat') do (
set DATESTAMP=%%t
)
echo !LOGNAME! already exists, renaming
ren "%TESTDIR%\!LOGNAME!" "!LOGNAME:.log=!_!DATESTAMP!.log"
)
call %READMXD% %1\%%a -s -b -y -e
)
endlocal
goto :eof