searching a dir with grep and making a list of links to file
Posted: Thu Nov 20, 2003 9:21 am
I am trying to make a web page that searches a directory pulling up a link list to all files (.txt, .html, .doc) that are located in the dir. I want the links to be clickable and it to spawn the document. Here is what I have so far. It searches the dir but jumbles everthing together and when you click the links it does not work. How could I make each entry on a single line and make it so when you click that entry it pulls the document? Thansk.
Mark
Code: --------------------------------------
<?php
$word = "online"; // word to search
$opt = "-ilr"; // ignore case, list files with matches, search recursive
#$path = "/home/client/public_html/";
$result = `grep $opt $word ./\n`;
echo "<a href = \"$result\">$result</a><BR>";
?>
Mark
Code: --------------------------------------
<?php
$word = "online"; // word to search
$opt = "-ilr"; // ignore case, list files with matches, search recursive
#$path = "/home/client/public_html/";
$result = `grep $opt $word ./\n`;
echo "<a href = \"$result\">$result</a><BR>";
?>