php1 Posted August 6, 2008 Share Posted August 6, 2008 Hi Is there any built in function to find the size and modification date of a directory ie: $path = "/var/www/html/php1/test"; is there any built in functions available to get the size and date of this directory Link to comment https://forums.phpfreaks.com/topic/118420-how-to-get-the-size-of-a-directory/ Share on other sites More sharing options...
Wuhtzu Posted August 6, 2008 Share Posted August 6, 2008 http://www.go4expert.com/forums/showthread.php?t=290 Link to comment https://forums.phpfreaks.com/topic/118420-how-to-get-the-size-of-a-directory/#findComment-609543 Share on other sites More sharing options...
php1 Posted August 8, 2008 Author Share Posted August 8, 2008 is there any php built-in function to find the size of a directory and the date of that particular directory Link to comment https://forums.phpfreaks.com/topic/118420-how-to-get-the-size-of-a-directory/#findComment-611491 Share on other sites More sharing options...
thebadbad Posted August 8, 2008 Share Posted August 8, 2008 No. Check Wuhtzu's link. You can use filemtime() to find each file's modification time, and then maybe display the newest as the modification time of the directory. Link to comment https://forums.phpfreaks.com/topic/118420-how-to-get-the-size-of-a-directory/#findComment-611498 Share on other sites More sharing options...
Wuhtzu Posted August 8, 2008 Share Posted August 8, 2008 No, as thebadbad says, there is no built-in function for doing that, you have to write your own... Link to comment https://forums.phpfreaks.com/topic/118420-how-to-get-the-size-of-a-directory/#findComment-611815 Share on other sites More sharing options...
DarkWater Posted August 8, 2008 Share Posted August 8, 2008 You can try parsing out the results of: `ls -l | awk {'print $6" "$7" "$8'}` That'll get you the date, time, and name of every file in the current dir. You need to figure out how to get only directories. =P Link to comment https://forums.phpfreaks.com/topic/118420-how-to-get-the-size-of-a-directory/#findComment-611822 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.