How to get all files that matching a pattern (like *.txt) in the current directory in PHP

1 Answer

0 votes
foreach (glob("*.txt") as $filename) 
    echo "$filename size: " . filesize($filename) . " bytes<br />";



/*
run:

keywords-webpage.txt size: 249436086 bytes
new 3.txt size: 13640 bytes
robots.txt size: 0 bytes
...

*/

 



answered Jun 24, 2016 by avibootz
...