pmdesign Posted March 6, 2006 Share Posted March 6, 2006 Hi,I just wanna know if there's any standart PHP function for checking directories if they are empty or not. If anyone has an idea how to do this let me know. I just wrote a function looping a dir and collectiong info about the number of files there. If it's 0 the dir is empty.<?php $number_of_files = 0;if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $number_of_files++; } } closedir($handle); } ?> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now