Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Count total files of a folder (included sub-folders), place it and run !
- function count_files($path) {
- $file_count = 0;
- $dir_handle = opendir($path);
- if (!$dir_handle) return -1;
- while ($file = readdir($dir_handle)) {
- if ($file == '.' || $file == '..') continue;
- if (is_dir($path . $file)){
- $file_count += count_files($path . $file . DIRECTORY_SEPARATOR);
- }
- else {
- $file_count++;
- }
- }
- closedir($dir_handle);
- return $file_count;
- }
- die('INODES: '.count_files(dirname(__FILE__).'/'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement