Page 1 of 1

Code Help Needed - modify script to only include .htm files

Posted: Tue Jun 28, 2005 9:32 am
by phpnewbdude
Is there anyway to modify this script to only include certain file types? I only want to display .htm files.

Code: Select all

<?php   exec("/bin/ls -t /home/yourwebsite/www/ | head -10",$s);   
for  ($i=0;$i  <  count($s);$i++)     
echo "<a href=\"http://www.yourwebsite.com/$s[$i]\">$s[$i]</a><br>\n"; ?>

Posted: Tue Jun 28, 2005 9:43 am
by CoderGoblin
You would be better of to use the core directory/file handling commands in PHP. Have a look here for more information.

If php has functions to do it, it is always safer than using an exec command and more system independant.