Page 1 of 1
[SOLVED] Disk space...
Posted: Wed Mar 02, 2005 2:57 pm
by Joe
Is it possible to tell how much disk space I have used using PHP. If so, how?.
Posted: Wed Mar 02, 2005 3:05 pm
by smpdawg
Do you mean disk space on the machine that is running PHP?
Posted: Wed Mar 02, 2005 3:10 pm
by Joe
Yeah, like how much space all of my website files are using. disk_total_space() is a big no no, however using this little snippet I made is useful:
Code: Select all
echo nl2br(str_replace(" ", " ", shell_exec("du -chx ".$_SERVERї'DOCUMENT_ROOT'])));
All I need to do now is parse out the dir name, and calculate the overall size. Arrays and regular expressions should hopefully work
Any other suggestions?.
Posted: Wed Mar 02, 2005 3:16 pm
by Joe
No worries guys. I found that using 'c' as the only argument gives the total size
Cheers!.
Posted: Wed Mar 02, 2005 3:17 pm
by shiznatix
glad we could be of assistance
