Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ich bekomme entweder Fehler oder aber eine weie Seite??
- Mchte halt Datei-, Ordnerzahl und deren Gesamtgre..
- <?
- $dir = '.';
- chdir($dir);
- $scanned = scandir($dir);
- // get cumulated file size
- $du = array_reduce(
- $scanned,
- function($accu, $dir_entry) {
- return is_file($dir_entry) && is_int($fsize = filesize($dir_entry))
- ? $accu + $fsize
- : $accu;
- },
- 0
- );
- // get number of files (only)
- $num_files = array_reduce(
- $scanned,
- function($accu, $dir_entry) {
- return $accu + (is_file($dir_entry) ? 1 : 0);
- },
- 0
- );
- printf('directory usage: %s bytes', $du);
- printf('number of files: %s', $num_files);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement