REBOL [ Title: "Check.r" Author: "Donald Dalley" Email: ddalley@idirect.com Date: 22-04-2002 Version: 1.10.02 Purpose: { Check all files in a directory list for a particular text. Prints a list of file names that do not include the text. Only prints " OK!" if a file is good. } Comment: { This program was created mainly to check for incomplete web pages still downloaded by the REBOL programming language, versions 2.0 to 2.5, which is why it is written in REBOL, too. } Configure: { Use 'top-drawer to set which sub-directories the program is to check. All drawers in top-drawer with "-Data" in their names are now searhed for HTML files. Set the text strings ('headertext & 'searchtext) for which the program is to search. HTML tags are used to check for incomplete web pages. } History: 1.00.00 [ 20-07-1999 "First public release" ] 1.01.00 [ 20-04-2000 "Added ability to easily check more drawers" ] 1.01.01 [ 15-05-2000 "Made EITHER into IF, for drawer check" ] 1.01.02 [ 19-05-2000 "Changed report string." ] 1.01.03 [ 24-10-2000 "Changed the name of some drawers to check." ] 1.01.04 [ 31-08-2001 "Fixed drawer naming in report string." ] 1.10.00 [ 31-10-2001 {Made the top-drawer drawer search more friendly. Changed the drawer conditional filter to "-Data". Updated Configure: & Comment: to reflect changes. Made search reporting smarter. Minor other changes, mainly tidying up code. } ] 1.10.01 [ 13-11-2001 "Minor comment change." ] 1.10.02 [ 22-04-2002 "set missing variable assignment" ] ] ; end HEADER ;TRACE ON ; set text strings for which to search ; a negitive on headertext skips non-HTML pages ; a negative on searchtext changes the report string headertext: "" searchtext: "" found: 0 ; nonrelated files stopped run ; set the top directory to search top-drawer: %/SD1/ CHANGE-DIR top-drawer drawers: READ %. FOREACH drawer drawers [ ; If a -Data drawer IF FIND drawer "-Data" [ CHANGE-DIR JOIN top-drawer drawer found: 0 ; get directory listing & print it to screen files: READ %. PRINT JOIN NEWLINE [ "The following files may be checked for " searchtext ":" ] PRINT JOIN NEWLINE [ files NEWLINE ] ; check each file to see if the tag exists FOREACH file files [ ; make a new file name into a file! filename: file MAKE FILE! filename ; READ entire file into 'text text: READ filename last-word: FIND/LAST text searchtext ; filters out non-HTML files IF FIND text headertext [ ; looks for search string in 'text ; prints the name of files which do not have the search string ; prints " OK!" if it does - operational feedback EITHER FIND text searchtext [ PRINT " OK!" found: 1 ][ PRINT JOIN " No " [ searchtext " text in " drawer file ] ] ; end EITHER searchtext ] ; end IF headertext ] ; end FOREACH file ] ; end IF -Data found ; report if no HTML files were in a drawer IF found = 0 [ PRINT [ JOIN " No " [ headertext " found in " drawer "." ]]] ] ; end FOREACH drawer PRINT JOIN NEWLINE [ NEWLINE " Please send feedback to ddalley@idirect.com." NEWLINE ]