$folder = $_SERVER['DOCUMENT_ROOT'].'/projects/charli/dashboard/'; $folder = escapeshellcmd($folder); if( ! is_dir($folder) ) { echo "$folder is not a folder.<br />"; } else { $output = `du -s $folder`; if( preg_match('/([0-9]+)(\t.*)/',$output,$match) ) { $size = $match[1]; echo "Folder $folder is $size bytes<br />"; } else { echo "Error fetching folder size, are you on Linux? and can you execute commands?<br />"; } }
shell_exec
escapeshellcmd
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)