#19772 [Com]: feature request count_files() and count_directories()
ID: 19772 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Closed Bug Type: Feature/Change Request Operating System: Windows XP Home PHP Version: 4.2.3 New Comment: I tried downloading a snapshot from shaps.php.net but when I do phpinfo(), it says I have PHP 4.4.0-dev. (I downloaded php4-win32-latest.zip on October 9th) Anyways, I tried glob() but it doesn't do anything and it doesn't ouput an error message either. I tried many things but it's still blank... Thanks, PsykX Previous Comments: [2002-10-07 15:36:28] [EMAIL PROTECTED] It only exists in the 4.3.0 dev version, get a non-stable snapshot from snaps.php.net Derick [2002-10-07 15:35:07] [EMAIL PROTECTED] glob() doesn't seem to work on 4.2.3 [2002-10-07 12:12:23] [EMAIL PROTECTED] This is what can be used for this: http://www.php.net/manual/en/function.glob.php No special functions for just counting files/dirs are not needed. [2002-10-05 18:52:12] [EMAIL PROTECTED] That's an idea but I already used readdir :) I didn't think I could use it for directories, though... It's just that since I don't use mysql, I use it often to count stuff in my databases (e.g.: My news database outputs the number of news and the number of news = the number of files in the directory) and it makes scripts more complicated. I always have to copy the same code everywhere because I can't remember it. Thanks, PsykX [2002-10-05 17:49:26] [EMAIL PROTECTED] Well, you should do that with readdir() with incrementing a variable. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/19772 -- Edit this bug report at http://bugs.php.net/?id=19772edit=1
#19772 [Com]: feature request count_files() and count_directories()
ID: 19772 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Closed Bug Type: Feature/Change Request Operating System: Windows XP Home PHP Version: 4.2.3 New Comment: glob() doesn't seem to work on 4.2.3 Previous Comments: [2002-10-07 12:12:23] [EMAIL PROTECTED] This is what can be used for this: http://www.php.net/manual/en/function.glob.php No special functions for just counting files/dirs are not needed. [2002-10-05 18:52:12] [EMAIL PROTECTED] That's an idea but I already used readdir :) I didn't think I could use it for directories, though... It's just that since I don't use mysql, I use it often to count stuff in my databases (e.g.: My news database outputs the number of news and the number of news = the number of files in the directory) and it makes scripts more complicated. I always have to copy the same code everywhere because I can't remember it. Thanks, PsykX [2002-10-05 17:49:26] [EMAIL PROTECTED] Well, you should do that with readdir() with incrementing a variable. [2002-10-05 15:45:37] [EMAIL PROTECTED] I think it would be handy to have these 2 functions. The difference is that one would count files and the other counts directories, like you probably guessed it. For example, if you d'like to count files ending with php3 and directories, you would do this : --- //Opens a directory and counts files and folders in it $dir = opendir(string path); $files = count_files($dir, php3); $directories = count_directories($dir); closedir($dir); //Outputs the number of files and directories echo $files; echo br; echo $directories; --- If you d'like to count every files you would put nothing in the extension parameter I know there's a way to count files and directories but it would be a shortcut function. Thanks, PsykX (Sorry for my english...) -- Edit this bug report at http://bugs.php.net/?id=19772edit=1
#19772 [Com]: feature request count_files() and count_directories()
ID: 19772 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Feature/Change Request Operating System: Windows XP Home PHP Version: 4.2.3 New Comment: That's an idea but I already used readdir :) I didn't think I could use it for directories, though... It's just that since I don't use mysql, I use it often to count stuff in my databases (e.g.: My news database outputs the number of news and the number of news = the number of files in the directory) and it makes scripts more complicated. I always have to copy the same code everywhere because I can't remember it. Thanks, PsykX Previous Comments: [2002-10-05 17:49:26] [EMAIL PROTECTED] Well, you should do that with readdir() with incrementing a variable. [2002-10-05 15:45:37] [EMAIL PROTECTED] I think it would be handy to have these 2 functions. The difference is that one would count files and the other counts directories, like you probably guessed it. For example, if you d'like to count files ending with php3 and directories, you would do this : --- //Opens a directory and counts files and folders in it $dir = opendir(string path); $files = count_files($dir, php3); $directories = count_directories($dir); closedir($dir); //Outputs the number of files and directories echo $files; echo br; echo $directories; --- If you d'like to count every files you would put nothing in the extension parameter I know there's a way to count files and directories but it would be a shortcut function. Thanks, PsykX (Sorry for my english...) -- Edit this bug report at http://bugs.php.net/?id=19772edit=1