Loading ...
Sorry, an error occurred while loading the content.

reg:files

Expand Messages
  • skumar_sss
    hello any one can say about how to seperate the files and folder in a particular directory.
    Message 1 of 3 , Nov 24, 2006
    • 0 Attachment
      hello

      any one can say about how to seperate the files and folder in a
      particular directory.
    • Mani Shankar Dwivedi
      ... Recursive Directory File Lister
      Message 2 of 3 , Nov 26, 2006
      • 0 Attachment
        --- In bang-phpug@yahoogroups.com, "skumar_sss" <skumar_sss@...> wrote:
        >
        > hello
        >
        > any one can say about how to seperate the files and folder in a
        > particular directory.
        >

        <html>
        <head>
        <title>Recursive Directory File Lister</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <style>
        <!--
        a{text-decoration:none}
        //-->
        </style>
        </head>

        <body>
        <?php
        /*
        Recursive directory file lister

        Scans through the current directory, and lists all the files and
        folders in it
        it then goes onto the next directory and lists all the files and
        folders in that
        etc etc

        File Vesion 1.3

        Changes:
        1.0 -> 1.2
        Auto finds the root path of the directory
        Auto finds the www. path of the directory
        added the view link and file numbers
        1.2 - 1.3
        Complete Rewrite
        Added File Sizes
        Made into a mambo component
        Displays In Tree Format
        Folders Displayed In Bold
        Added Total File Sizes and Number Of Folders

        */

        function direcho($path) {
        global $filetotal, $fullsize, $totaldirs;
        if ($dir = opendir($path)) {
        while (false !== ($file = readdir($dir))) {
        if (is_dir($path."/".$file)) { // if it's a dir,
        check it's contents too
        if ($file != '.' && $file != '..') { // but don't go
        recursive on '.' and '..'
        echo '<li><img src="folder.jpg"><a href = ' . $path."/".$file .
        '><b>' . $file . '</b></a></li><ul>';
        direcho($path."/".$file);
        echo '</ul>';
        $totaldirs++;
        }
        }
        else { //if it's not a dir, just output.
        $tab = "      ";
        $filesize = $tab . '(' . filesize ($path.'/'.$file) . ' bytes)';
        echo '<li>' . $file . $filesize . '</li>';
        $fullsize = $fullsize + filesize ($path.'/'.$file);
        $filetotal++;
        }
        }
        closedir($dir);
        }
        }

        direcho('.');

        $fullsize = round($fullsize / 1024 / 1024, 2);







        echo "<font size=\"2\" face=\"Arial, Helvetica, sans-serif\">
        <b>Total files</b> - $filetotal files<br>
        <b>Total dirs</b> - $totaldirs directories<br>
        <b>Total size</b> - $fullsize MB<br>";
        ?>
        </body>
        </html>

        this code list the current folder's file list and sub-folder list
        folder shows as an icon "folder.jpg" u can make your own image.
        this programs also returns the count/size of files & folder
      • Ved Prakash
        Hi SKumar, Can you please elaborate your question in detail? Regards
        Message 3 of 3 , Nov 27, 2006
        • 0 Attachment
          Hi SKumar,

          Can you please elaborate your question in detail?

          Regards
          --- In bang-phpug@yahoogroups.com, "skumar_sss" <skumar_sss@...> wrote:
          >
          > hello
          >
          > any one can say about how to seperate the files and folder in a
          > particular directory.
          >
        Your message has been successfully submitted and would be delivered to recipients shortly.