Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 8 of 8
  1. #1
    Join Date
    Nov 2007
    Posts
    1,111
    Tokens
    0

    Latest Awards:

    Default Displaying number of files in a remote folder

    Anyone know of any scripts to show on a page how many files are in a certain folder?

  2. #2
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    What do you mean, as in cPanel or just an index?

  3. #3
    Join Date
    Nov 2007
    Posts
    1,111
    Tokens
    0

    Latest Awards:

    Default

    just a folder, for example i wanted to display how many files had been uploded into the uploads folder

  4. #4
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Here's a code from my TehUpload core.

    PHP Code:
        /**
         * Numbers files in a directory
         *
         * @param string $dir
         * @param boolean $recursive
         * @param integer $counter
         * @return integer
         */
        
    public function numFiles $dir$recursive false$counter )
        {
            static 
    $counter;
            if ( 
    is_dir$dir ) ) {
                if ( 
    $dh opendir$dir ) ) {
                    while ( ( 
    $file readdir$dh ) ) !== false ) {
                        if ( 
    $file != "." && $file != ".." ) {
                            
    $counter = ( is_dir$dir "/" $file ) ) ? num_files$dir "/" $file$recursive$counter ) : $counter 1;
                        }
                    }
                    
    closedir$dh );
                }
            }
            return 
    $counter;
        } 
    Usage:

    PHP Code:
    echo $core->numFiles('images/'); 
    That is if it is in a class.

    PHP Code:
    echo numFiles('images/'); 
    You'll need to remove public for it to work out of PHP5 and a class.
    Last edited by Dentafrice; 19-06-2008 at 01:09 PM.

  5. #5
    Join Date
    Nov 2007
    Posts
    1,111
    Tokens
    0

    Latest Awards:

    Default

    still havent found any that actually work

  6. #6
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    That works perfect..

  7. #7
    Join Date
    Nov 2007
    Posts
    1,111
    Tokens
    0

    Latest Awards:

    Default

    didnt for me

  8. #8
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    did it error?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •