hi,
i want to get size of a Directory and delete a file called old.php when the directory's total size is larger than 500mb.
how to do it?
i am new to PHP trying to make my work easy using PHP
help me plz...
Thanx
how to get directory/folder size and delete files inside
Moderator: General Moderators
-
Dss.Lexius
- Forum Newbie
- Posts: 11
- Joined: Fri Jun 11, 2010 12:18 pm
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: how to get directory/folder size and delete files inside
As far as I know you need to loop through the directory using glob() maybe and add the filesize() of each file. If the directory contains subdirectories then you need to recursively list files within those etc... If on linux you could just exec() the du command.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.