@echo off
echo b.btm -- process brokenlinks
rem run brokenlink on mindprod.com database, and apply selected permmanent and temporary redirects
Rem This is what I use myself. You might do something simpler, or do these steps manually.
pushd
cdd E:\com\mindprod\brokenlinks
rem Jet is Excelsior native compiler for Java. Gives extra speed and allows simpler exe invocation
if "%runwith" == "" set runwith=jet
if "%runwith" == "jet" goto usingjet
:notusingjet
set brokenlinks=java.exe -ea -jar E:\com\mindprod\brokenlinks\brokenlinks.jar
set csvalign=java.exe -ea -jar E:\com\mindprod\csv\csvalign.jar
set csvpatch=java.exe -ea -jar E:\com\mindprod\csv\csvpatch.jar
set csvsort=java.exe -ea -jar E:\com\mindprod\csv\csvsort.jar
set extracti=java.exe -ea -jar E:\com\mindprod\extract\extracti.jar
set csvreplaceurls=java.exe -ea -jar E:\com\mindprod\csv\csvreplaceurls.jar
set withouti=java.exe -ea -jar E:\com\mindprod\extract\withouti.jar
goto setsready
:usingjet
set brokenlinks=java.exe com.mindprod.brokenlinks
set csvalign=csvalign.exe
set csvpatch=csvpatch.exe
set csvsort=csvsort.exe
set extracti=extracti.exe
set csvreplaceurls=csvreplaceurls.exe
set withouti=withouti.exe
:setsready
rem -30-
%brokenlinks% mindprod.properties
cdd E:\mindprod\jgloss
rem import the generated list of broken links and display them in the browser. I manually fix them with an editor.
rem one.btm is part of HTML macros to expand macros, then display the file E:\mindprod\jgloss\brokenlinks.html.
rem It is not part of brokenlinks.
call one brokenlinks.html
Rem when finished using browser, deal with redirects. bl is where I have brokenlinks deposit its generated files.
cdd E:\env\bl
Rem list of keywords in URLS I normally don't want to redirect. Redirects for affiliates usually lose my payment ids.
set avoid=anrdoezrs barnesandnoble clickbank condomblogs esellerate linksynergy linksynergy nytimes phone qksrv sextoy Victoria webring
rem withouti is part of the extract/without package available for download free at mindprod.com
%withouti% %avoid - permanentRedirects.csv > safepermanent.csv
%csvsort%  safepermanent.csv 2s+  1s+
%csvalign% safepermanent.csv
Rem wake up Vslick editor and let me prune the permanent safe list further. I can also modify what I want the old URLs redirected to, based on
Rem research with my browser.
vs safepermanent.csv
Rem confirm that I want the pruned list of safe permanent redirects applied.
echo.
echo apply safe permanent redirects?
rem Confirm is available for download free at mindprod.com
confirm.exe
if ERRORLEVEL 1 goto bypass1
Rem replace the safe permanently changed urls in file in the E:\mindprod website. Names of files where they occur are embedded.
%csvreplaceurls% safepermanent.csv
echo patching hassle.csv
Rem patch the first (0th) column of URLs in hassle.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\submitter\hassle.csv safepermanent.csv 1 2
echo patching nohassle.csv
Rem patch the first (0th) column of URLs in nohassle.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\submitter\nohassle.csv safepermanent.csv 1 2
echo patching candidates.csv
Rem patch the first (0th) column of URLs in candidates.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\submitter\candidates.csv safepermanent.csv 1 2
echo patching phone.csv
Rem patch the second (1th) column of URLs in phone.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\phone\phone.csv safepermanent.csv 1
echo patching air.csv
rem ditto for air.csv
rem csvpatch is available for download free at mindprod.com part of the csv package.
%csvpatch% E:\com\mindprod\repair\air.csv safepermanent.csv 4
pause
:bypass1
rem suspended
set suspend=error suspend 404 shawcaassist
%extracti% %suspend% - permanentRedirects.csv > suspended.csv
%extracti% %suspend% - temporaryRedirects.csv >> suspended.csv
%csvsort%  suspended.csv 2s+  1s+
%csvalign% suspended.csv
rem load dead.csv first so it will be at the back
vs E:\com\mindprod\submitter\dead.csv   suspended.csv
Echo. You will need to apply the suspended.csv changes manually as if they were 404 broken links.
echo.
pause
Rem temporary redirects
%withouti% %avoid - temporaryRedirects.csv > safetemporary.csv
%csvsort%  safetemporary.csv 2s+ 1s+
%csvalign% safetemporary.csv
Rem wake up Vslick editor and let me prune the temporary safe list further.
vs safetemporary.csv
echo.
echo apply safe temporary redirects?
confirm.exe
if ERRORLEVEL 1 goto bypass2
echo it is unusual to apply temporaries. Are you sure?
confirm.exe
if ERRORLEVEL 1 goto bypass2
Rem replace the safe temporarily changed urls in file in the E:\mindprod website. Names of files where they occur are embedded.
%csvreplaceurls% safetemporary.csv
echo patching hassle.csv
Rem patch the first (0th) column of URLs in hassle.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\submitter\hassle.csv safetemporary.csv 1 2
echo patching nohassle.csv
Rem patch the first (0th) column of URLs in nohassle.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\submitter\nohassle.csv safetemporary.csv 1 2
echo patching candidates.csv
Rem patch the first (0th) column of URLs in candidate.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\submitter\candidates.csv safetemporary.csv 1 2
echo patching phone.csv
Rem patch the second (1th) column of URLs in phone.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\phone\phone.csv safetemporary.csv 1
echo patching air.csv
rem ditto for air.csv
%csvpatch% E:\com\mindprod\repair\air.csv safetemporary.csv 4
pause
:bypass2
rem phone directs
%extracti% phone - permanentRedirects.csv > phoneredirects.csv
%csvsort%  phoneredirects.csv 2s+ 1s+
%csvalign% phoneredirects.csv
vs phoneredirects.csv
Rem confirm that I want the pruned list of phone redirects applied.
echo.
echo apply phone redirects?
confirm.exe
if ERRORLEVEL 1 goto bypass3
echo it is unusual to apply phone redirects. Are you sure?
confirm.exe
if ERRORLEVEL 1 goto bypass3
echo patching phone.csv
Rem patch the second (1th) column of URLs in phone.csv with the permanently redirected urls
%csvpatch% E:\com\mindprod\phone\phone.csv phoneredirects.csv 1
rem we don't patch the E:\mindprod\phone\phon*.html files. They will soon be regenerated.
:bypass3
Rem tidy the csv files that may have been recently updated, using CSVAlign etc.
echo tidying hassle.csv
call E:\com\mindprod\submitter\tidy.btm
echo tidy htmlmacros csv files
call E:\com\mindprod\htmlmacros\tidy.btm
echo tidying air.csv
call E:\com\mindprod\repair\tidyair.btm
echo tidying phone.csv
call E:\com\mindprod\phone\prepare.btm
echo fixing css classes
call E:\com\mindprod\repair\assigncssclasseses.btm
echo fixing htmlmacros cvs
call E:\com\mindprod\htmlmacros\tidy.btm
rem no longer need giant Xenu report file
cdd E:\env\bl
del xenupage.csv
popd
echo d o n e
rem -30-