@echo off
echo bl.btm -- process brokenlinks using jet
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
set confirm=
cdd E:\env\bl
java.exe com.mindprod.brokenlinks.brokenlinks
copy include.html E:\mindprod\jgloss\include\brokenlinks.htmlfrag
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 kobo linksynergy linksynergy nytimes phone qksrv  Victoria webring
rem withouti is part of the extract/without package available for download free at mindprod.com
withouti.exe %avoid - permanentredirects.csv > 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.
rem is already aligned, but since records removed, could be tighter
csvalign safepermanent.csv
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.exe safepermanent.csv
echo patching hassle.csv
Rem patch the first (0th) column of URLs in hassle.csv with the permanently redirected urls
csvpatch.exe 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.exe 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.exe 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.exe 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.exe E:\com\mindprod\repair\air.csv safepermanent.csv 4
pause
:bypass1
rem suspended
set suspend=error suspend 404 shawcaassist
extracti.exe %suspend% - permanentRedirects.csv > suspended.csv
extracti.exe %suspend% - temporaryRedirects.csv >> suspended.csv
rem load dead.csv first so it will be at the back
rem is already aligned, but since records removed, could be tighter
csvalign suspended.csv
vs.exe E:\com\mindprod\submitter\dead.csv E:\com\mindprod\submitter\hassle.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.exe %avoid - temporaryRedirects.csv > safetemporary.csv
rem is already aligned, but since records removed, could be tighter
csvalign safetemporary.csv
vs.exe 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.exe safetemporary.csv
echo patching hassle.csv
Rem patch the first (0th) column of URLs in hassle.csv with the permanently redirected urls
csvpatch.exe 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.exe 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.exe 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.exe E:\com\mindprod\phone\phone.csv safetemporary.csv 1
echo patching air.csv
rem ditto for air.csv
csvpatch.exe E:\com\mindprod\repair\air.csv safetemporary.csv 4
pause
:bypass2
rem phone directs
extracti.exe phone - permanentRedirects.csv > phoneredirects.csv
rem is already aligned, but since records removed, could be tighter
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.exe 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.
set confirm=n
echo tidying submitter csvs
call E:\com\mindprod\submitter\tidy.btm
echo tidy htmlmacros csvs
call E:\com\mindprod\htmlmacros\tidy.btm
echo tidying air.csv
call E:\com\mindprod\repair\tidyair.btm
echo mark acronyms
call E:\com\mindprod\acronym\markacronyms.btm
echo collect birthdays
call E:\com\mindprod\repair\preparebirths.btm
echo refresh embellishments.
call E:\com\mindprod\htmlmacros\validateembellishments.btm
echo fixing css classes
call E:\com\mindprod\repair\assigncssclasseses.btm
rem fc wrecks includes.
echo tidy books, dvds, electronics
call E:\com\mindprod\stores\tidy.btm
rem echo tidying phone.csv, alreody done as side effect.
rem call E:\com\mindprod\phone\prepare.btm
rem no longer need giant Xenu report file
cdd E:\env\bl
del xenupage.csv
set confirm=
popd
echo d o n e
rem -30-