List files script

Discussion in 'PHP' started by tr1x, Jun 15, 2008.

  1. #1
    I've looked for hours but I can't find the script that I need, and I'm not good enough at PHP to write it myself, so I was wondering if someone could share some code with me.

    All I need is a script that will list all the files in a directory, and display the filesize next to the filename. Also.. since I have over 1,000 files in the directory, is it possible to make it display like 100 per page or something?

    Any help is greatly appreciated.
     
    tr1x, Jun 15, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    It's fairly easy to create something like that, check out http://www.php.net/opendir for more info or ofyou like to pay a bit please PM me and i'll create something for you
     
    EricBruggema, Jun 15, 2008 IP
  3. godkillah

    godkillah Guest

    Messages:
    34
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    something like this?

    Source: phphulp.nl
    <?
    $dir = "/var/www/directory";
    $exten = 'html';
    if ($handle = @opendir($dir)) 
    {
        while (false !== ($file = @readdir($handle))) { 
            $bestand = $dir ."/". $file ;
            $ext = pathinfo($bestand);
            if($ext['extension'] == $exten)
            {
                echo " •  <a href='/module/". $file ."' target='_blank'>". basename($file, ".php") ."</a><br>" ;
            }
        }
        @closedir($handle); 
    } 
    ?> 
    PHP:
     
    godkillah, Jun 16, 2008 IP
  4. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #4
    @godkillah; that isn't what he ment, he wanted to nagivate tru the filelisting by 100 files a page..

    PS. if you like to pay, PM me and i'll create it for you! :)
     
    EricBruggema, Jun 16, 2008 IP
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    Just use glob... Very simple. Can't get confused with it.
     
    Danltn, Jun 16, 2008 IP