PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
which is the best way to calculate disk usage on a directory (and its subdirectory) using php without receing errors if a not readable dir is found ?
I tried to use @shell_exec() and @passthru with the linux command du , but if "du" find some not readable directory it reports error (and there is no way to hide it )
I've had good luck using php's file system functions for this stuff. Haven't used it to calucltae the file sizes but there is a filsize function which should do the trick. Using readdir and readfile along with filesize you can make a script that reads all the files and folders and gets the sizes of each file, then just store the info in an array and do some calculations on it.