note 77213 deleted from language.operators.execution by danbrown
| From: | danbrown@php.net | Date: | Mon, 28 Jul 2008 16:48:11 +0000 |
| Subject: | note 77213 deleted from language.operators.execution by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142861@lists.php.net to get a copy of this message | ||
Note Submitter: tinman at robotterror dot com
----
Using a backtick script on Linux to make a little directory lister/linker:
<?php
$output =
ls -1|fgrep -v index.php |awk '{ print "<a href=" $1
">" $1 "</a>" }';
echo "<pre>$output</pre>";
?>
Save as index.php with whatever HTML formatting you desire.
Then, to put this script in the subdirs for recursive listing/linking, do this at the command line:
# find . -mindepth 2 -type d -exec ln index.php {}/ \;
Of course, I'm assuming there is not already a "index.php" file in the subdirs.
A break down of the command line in the backticks:
* ls -1 # list one file per line (note, not "ls -l")
* fgrep -v index.php # exclude the index page
* awk ... # grab each line from ls -1 and wrap with A HREF tags
Have fun!