Lyrical Beatz (Archived)
" . $path . "
"; # Initialise list arrays, directories and files separately and array counters for them $d_arr = array(); $d = 0; $f_arr = array(); $f = 0; # Open possibly available directory if( is_dir( $path ) ) { if( $handle = opendir( $path ) ) { while( false !== ( $file = readdir( $handle ) ) ) { # Make sure we don't push parental directories or dotfiles (unix) into the arrays if( $file != "." && $file != ".." && $file[0] != "." ) { if( is_dir( $path . "/" . $file ) ) # Create array for directories $d_arr[$d++] = $file; else # Create array for files $f_arr[$f++] = $file; } } } } # Wrap things up if we're in a directory if( is_dir( $handle ) ) closedir( $handle ); # Sort and reset the arrays asort( $d_arr ); reset( $d_arr ); asort( $f_arr ); reset( $f_arr ); # Print a parent directory link $d_prev = substr( $path, 0, ( strrpos( dirname( $path . "/." ), "/" ) ) ); print " Parent directory
\n"; # Print the directory list for( $i=0; $i < count( $d_arr ); $i++ ) { # Print with query string ?> " . $d_arr[$i] . "/
\n"; } # Print file list for( $i=0; $i < count( $f_arr ); $i++ ) { # Only print path and filename ?> " . $f_arr[$i] . ""; # We may want a file size. NOTE: needs $path to stat if( filesize( $path . "/" . $f_arr[$i] ) >= 1024 ) { # Size in kilobytes print " " . round( filesize( $path . "/" . $f_arr[$i] ) / 1024, 1 ) . " KB
\n"; } elseif( filesize( $path . "/" . $f_arr[$i] ) >= 1048576 ) { # Size in megabytes print " " . round( filesize( $path . "/" . $f_arr[$i] ) / 1024 / 1024, 1 ) . " MB
\n"; } else { # Size in bytes print " " . filesize( $path . "/" . $f_arr[$i] ) . " bytes
\n"; } } ?>
"; # Initialise list arrays, directories and files separately and array counters for them $d_arr = array(); $d = 0; $f_arr = array(); $f = 0; # Open possibly available directory if( is_dir( $path ) ) { if( $handle = opendir( $path ) ) { while( false !== ( $file = readdir( $handle ) ) ) { # Make sure we don't push parental directories or dotfiles (unix) into the arrays if( $file != "." && $file != ".." && $file[0] != "." ) { if( is_dir( $path . "/" . $file ) ) # Create array for directories $d_arr[$d++] = $file; else # Create array for files $f_arr[$f++] = $file; } } } } # Wrap things up if we're in a directory if( is_dir( $handle ) ) closedir( $handle ); # Sort and reset the arrays asort( $d_arr ); reset( $d_arr ); asort( $f_arr ); reset( $f_arr ); # Print a parent directory link $d_prev = substr( $path, 0, ( strrpos( dirname( $path . "/." ), "/" ) ) ); print " Parent directory
\n"; # Print the directory list for( $i=0; $i < count( $d_arr ); $i++ ) { # Print with query string ?> " . $d_arr[$i] . "/
\n"; } # Print file list for( $i=0; $i < count( $f_arr ); $i++ ) { # Only print path and filename ?> " . $f_arr[$i] . ""; # We may want a file size. NOTE: needs $path to stat if( filesize( $path . "/" . $f_arr[$i] ) >= 1024 ) { # Size in kilobytes print " " . round( filesize( $path . "/" . $f_arr[$i] ) / 1024, 1 ) . " KB
\n"; } elseif( filesize( $path . "/" . $f_arr[$i] ) >= 1048576 ) { # Size in megabytes print " " . round( filesize( $path . "/" . $f_arr[$i] ) / 1024 / 1024, 1 ) . " MB
\n"; } else { # Size in bytes print " " . filesize( $path . "/" . $f_arr[$i] ) . " bytes
\n"; } } ?>