REBOL [ title: "Simple Search" date: 17-may-2009 file: %simple-search.r author: Nick Antonaccio purpose: { Searches though all files in all subdirectories to find given text in each file. Taken from the tutorial at http://musiclessonz.com/rebol_tutorial.html (a website CGI version of the script is also given in the tutorial). } ] phrase: request-text/title/default "Text to Find:" "the" start-folder: request-dir/title "Folder to Start In:" change-dir start-folder found-list: "" recurse: func [current-folder] [ foreach item (read current-folder) [ if not dir? item [ if find (read to-file item) phrase [ print rejoin [{"} phrase {" found in: } what-dir item] found-list: rejoin [found-list newline what-dir item] ] ] ] foreach item (read current-folder) [ if dir? item [ change-dir item recurse %.\ change-dir %..\ ] ] ] print rejoin [{SEARCHING for "} phrase {" in } start-folder "...^/"] recurse %.\ print "^/DONE^/" editor found-list halt cgi-version: [ #! /home/yourpath/public_html/rebol/rebol -cs REBOL [] print "content-type: text/html^/" print [
] print [] print [ |