%!ps % URL finder approach to 404 detection % ======= % Author and date % Function % Details % ====== % Projects at http://www.tinaja.com/pssamp1.shtml % scheme to find and repair web 404's. % ======= % Uncomment and modify to use disk based Gonzo. ( or other disk access ) (C:/Users/Don/Desktop/Ghost/gonzo.psl) run % use internal /guru { gonzo begin ps.util.1 begin printerror nuisance begin} def guru % activate gonzo utilities % ============================== % filenames to be searched are presently in C:/Users/don/Desktop/Web/shtml_stash1/ % a stash of current 404 problems are presently in C:/Users/don/Desktop/Web/probs.txt % and presently need extracted one at a time % IMPORTANT: Be sure your file prefixes are EXACTLY right! % Also be sure to reload your .shml stash after fixing anyreal ones! % Note that PostScript searches are case sensitive! Many others are not. /soughtafter (fn1) store % the problem 404 /soughtafter (.jsp) store % temp test /fileprefix (C:/Users/don/Desktop/Web/fix_404/shtml_stash1/) store % the file prefix 65000 string /blocklen exch def % size of searchblock 200 string /filenamestr exch def % size of filenamelength - may have to be huge % ============================== /findfiles { % the main outer program loop % note hardwaire 1 in name fileprefix {(1) search { pop pop reportfile} {prefixerror} ifelse } filenamestr filenameforall } store % =============================== /reportfile { % top level link % findfile processor /curfilename exch store (\nPresently searching ) curfilename mergestr (.\n) mergestr print readcurfilename } store % ==================================== /readfile {fileprefix curfilename mergestr (r) file /nowfile exch store } store /readcurfilename { % assumes loop will not hang readfile % finds newfile file name /nowfilepos 0 store nowfile 0 setfileposition { % start block reads loop % (\n\n fileposition is now ) nowfile fileposition 100 string cvs mergestr print nowfile blocklen readstring { searchfile }{ searchfile exit} ifelse nowfile fileposition 65000 add nowfile exch setfileposition } loop } store % =============================== /searchfile { soughtafter search { ( Found at least one instance of " ) soughtafter mergestr ( " in ) mergestr curfilename mergestr ( .\n) mergestr print } { } ifelse } store % temp %%%%% Main program starts here %%%%%% stopwatchon % for timing findfiles (\n\n) print stopwatchoff showpage % EOF