Looking at files within a folder...
file2.txt<?php
$handle = opendir('./sub');
while(false !== ($file = readdir($handle))){
if($file != '.' && $file != '..') {
echo "$file<br />";
}
}
closedir($handle);
?>