Count files in Spicyfm script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Count files in Spicyfm script

    Good day, please, i would like to show the number of files in each directory on Spicyfm script which i downloaded but i don't know how to do that. please help me.
    An example is:

    Pictures (number of files)
    Application (number of files)

    Your response will be so much appreciated. Thanks very much

    #2
    PHP Code:
    $dir_path "/path/to/directory/";
    $count count(glob($dir_path "*"));

    if(
    $count >= 1){
     echo 
    $count;

    } else {
     echo 
    0;

    sigpic

    Comment


      #3
      Where i put it?

      Comment


        #4
        Where you want it to appear.

        Just a little modified:

        PHP Code:
        function count_files($dir_path ''$what '') {
            
        $count count(glob($dir_path.'/*.'.$what.''));
            return echo 
        'There is '.($count 
                    
        '<b>'.$count.'</b> files' : ($count == 
                    
        '<b>one</b> file' '<b>no files</b>')).' in '.dirname($dir_path).'<br/>'.PHP_EOL;
        }
        //
        count_files('downloads/images''jpg');
        count_files('downloads/images''jpg|jpeg');
        count_files('downloads/videos''3gp');
        count_files('downloads/videos''3gp|mp4'); 
        Last edited by arnage; 10.10.12, 17:04.
        <!DOCTYPE html PUBLIC "-//WAPFORUM.RS

        Comment

        Working...
        X