read())
    {
        $size = filesize("$dir$filename");

        if (is_dir("$dir$filename"))
        {
            $type = 'dir';
            $filename .= '/';
        }
        else
        {
            $type = 'file';
        }

        if (is_readable("$dir$filename"))
        {
            $line = str_pad($size, 15);
            $line .= "$filename";
        }
        else
        {
            $line = str_pad($size, 15);
            $line .= $filename;
        }

        echo "$line\n";
    }

    $handle->close();
}

?>