Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
GreenGeeks Web Hosting - Faster, Scalable & Eco-Friendly

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


7,786 questions

10,872 answers

573 users

How to get the size of all the text files from a directory in PHP

1 Answer

0 votes
foreach (glob("d:\*.txt") as $filename) {
    echo "file: $filename - size: " . filesize($filename) . "<br />";
}

   
/*
run:
    
file: d:\3LData.txt - size: 296595
file: d:\a_list_of_100000_prime_numbers.txt - size: 16396
file: d:\backup.txt - size: 7
file: d:\data.txt - size: 18
file: d:\datefile.txt - size: 50
file: d:\error_log.txt - size: 32604072
file: d:\file.txt - size: 20
file: d:\numbers.txt - size: 61
file: d:\temp.txt - size: 311
file: d:\test.txt - size: 45
file: d:\tree.txt - size: 33

*/

 




answered Nov 28, 2017 by avibootz
...