Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
function DirStat($directory) {
global $FolderCount, $FileCount, $FolderSize;
chdir($directory);
$directory = getcwd();
if($open = opendir($directory)) {
while(false !== ($file = readdir($open))) {
if($file == '..' || $file == '.') continue;
if(is_file($file)) {
$FileCount++;
$FolderSize += filesize($file);
} elseif(is_dir($file)) {
$FolderCount++;
}
}
if($FolderCount > 0) {
$open2 = opendir($directory);
while($folders = readdir($open2)) {
$folder = $directory.'/'.$folders;
if($folders == '..' || $folders == '.') continue;
if(is_dir($folder)) {
DirStat($folder);
}
}
closedir($open2);
}
closedir($open);
}
}
function ByteSize($bytes) {
$size = $bytes / 1024;
if($size < 1024){
$size = number_format($size, 2);
$size .= 'kb';
} else {
if($size / 1024 < 1024) {
$size = number_format($size / 1024, 2);
$size .= 'mb';
} elseif($size / 1024 / 1024 < 1024) {
$size = number_format($size / 1024 / 1024, 2);
$size .= 'gb';
} else {
$size = number_format($size / 1024 / 1024 / 1024, 2);
$size .= 'tb';
}
}
return $size;
}
$folder = 'test'; // тука пишеш името на папката
$dir = getcwd();
DirStat($folder, 0);
chdir($dir);
$FolderSize = ByteSize($FolderSize);
echo '<b>Folder Name:</b> '.$folder.'<br />'.chr(10);
echo '<b>File Count:</b> '.$FileCount.'<br />'.chr(10);
echo '<b>Folder Size:</b>'.$FolderSize.'<br />'.chr(10);
?>