foreach (glob("*.txt") as $filename) {
echo "$filename size " . filesize($filename) . "\n";
// unlink ($filename):
}
$dir = '../data/*.txt';
foreach (glob($dir) as $fn) {
$ext = pathinfo($fn);
echo $ext['filename']."<br>";
$ext = pathinfo($fn,PATHINFO_FILENAME);
echo $ext."<br>";
// echo $ext['basename']."<br>";
}
echo("- - -<br>");
$dir = '../data/';
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($fn = readdir($dh)) !== false) {
$ext = pathinfo($fn);
if ($ext['extension'] == "txt")
echo $fn."<br>";
}
closedir($dh);
}
}
echo("- - -<br>");
$dir = '../data/';
$files = scandir($dir);
foreach($files as $fn){
$ext = pathinfo($fn);
if ($ext['extension'] == "txt")
echo $fn."<br>";
}