Portrety Uliczne Nieznajomych - zobacz wyjątkową galerię portretów z warszawskich ulic
ZALOGUJ SIĘ
login:
hasło:
przypomnij hasło
załóż konto użytkownika
(i zobacz kilka porad gratis)
   
WYSZUKIWARKA I DZIAŁY
całe porady  tytuły
zaznacz działy do przeszukania
(brak wyboru = wszystkie działy)
PHP
MySQL >
PostgreSQL
SQLite
Perl
Java
XML
XSLT
XPath
WML
SVG
RegExp
Wyszukiwarki
Ochrona
VBScript
Google Plus
XHTML/CSS
JavaScript
Grafika
Flash
Photoshop
Windows
Linux
Bash
Apache
Procmail
E-biznes
Explorer
Opera
Firefox
Inne porady
   
KURSY, DOKUMENTACJE
Własne:
XHTML/CSS
JavaScript
ActionScript
WML, RSS, SSI
Pozostałe:
PHP
MySQL
Java API
więcej...
   
użytkowników online: 65
W CZYM MOGĘ POMÓC?


   
OPINIE UŻYTKOWNIKÓW
O wysokich kompetencjach zawodowych Darka nie ma co dyskutować. Wszyscy chyba jesteśmy zgodni co do tego, że Jego wiedza na polu informatycznym jest bogata i zasługuje na uznanie. Swego czasu zwróciłem się z prośbą o pomoc w realizacji małego projektu internetowego. Projekt był niewielki, jednak jego realizacja wymagała pewnego doświadczenia. Darek podjął się tego zlecenia, wykonał je szybko i sprawnie. Podczas realizacji służył doradztwem, jednak w żaden sposób nie narzucał swojego zdania. O prawidłowości Jego koncepcji przekonałem się dopiero po pewnym czasie. To, czego ja nie dostrzegałem, On dostrzegał i zwracał na to moją uwagę. Darek dał się poznać nie tylko, jako dobry fachowiec, co przede wszystkim okazał się być rzetelnym i uczciwym kontrahentem. Tak więc nie dość, że fachowiec, to jeszcze uczciwy. Polecam usługi Darka wszystkim tym, którzy szukają fachowej pomocy przy realizacji nawet najbardziej złożonych projektów.

Dariusz Żwan
Actuarius.pl

   
GALERIA FOTOGRAFII
   
PODRĘCZNIK PHP 5.x, 4.x, 3.x - częściowo spolszczony / źródło: www.php.net

[Spis] [A] [B] [C] [D] [E] [F] [G] [H] [I] [J] [K] [L] [M] [N] [O] [P] [Q] [R] [S] [T] [U] [V] [X] [W] [Z]

disk_total_space

(PHP 4 >= 4.1.0, PHP 5)

disk_total_space -- Zwraca całkowity rozmiar katalogu

Opis

float disk_total_space ( string katalog )

Podając łańcuch zawierający katalog, funkcja ta zwróci całkowity rozmiar (w bajtach) w odpowiadającym mu systemie plików lub partycji dysku.

Przykład 1. disk_total_space() przykład

<?php
// $df zawiera całkowitą liczbę bajtów dostępną w "/"
$df = disk_total_space("/");   

// w Windows: 
disk_total_space("C:"); 
disk_total_space("D:"); 
?>

Notatka: Ta funkcja nie będzie działać dla zdalnych plików, ponieważ przetwarzany plik musi być dostępny poprzez system plików serwera.

Zobacz także disk_free_space()




User Contributed Notes

shalless at rubix dot net dot au
16-Jul-2003 04:36

My first contribution. Trouble is the sum of the byte sizes of the files in your directories is not equal to the amount of disk space consumed, as andudi points out. A 1-byte file occupies 4096 bytes of disk space if the block size is 4096. Couldn't understand why andudi did $s["blksize"]*$s["blocks"]/8. Could only be because $s["blocks"] counts the number of 512-byte disk blocks not the number of $s["blksize"] blocks, so it may as well just be $s["blocks"]*512. Furthermore none of the dirspace suggestions allow for the fact that directories are also files and that they also consume disk space. The following code dskspace addresses all these issues and can also be used to return the disk space consumed by a single non-directory file. It will return much larger numbers than you would have been seeing with any of the other suggestions but I think they are much more realistic:

<?php
function dskspace($dir)
{
  
$s = stat($dir);
  
$space = $s["blocks"]*512;
   if (
is_dir($dir))
   {
    
$dh = opendir($dir);
     while ((
$file = readdir($dh)) !== false)
       if (
$file != "." and $file != "..")
        
$space += dskspace($dir."/".$file);
    
closedir($dh);
   }
   return
$space;
}
?>


andudi at gmx dot ch
12-Jun-2002 12:15

To find the total size of a file/directory you have to differ two situations:
(on Linux/Unix based systems only!?)

you are interested:
1) in the total size of the files in the dir/subdirs
2) what place on the disk your dir/subdirs/files uses

- 1) and 2) normaly differs, depending on the size of the inodes
- mostly 2) is greater than 1) (in the order of any kB)
- filesize($file) gives 1)
- "du -ab $file" gives 2)

so you have to choose your situation!

on my server I have no rights to use "exec du" in the case of 2), so I use:
  $s = stat($file);
  $size = $s[11]*$s[12]/8);
whitch is counting the inodes [12] times the size of them in Bits [11]

hopes this helps to count the used disk place in a right way... :-)

                     Andreas Dick


kit at 4me dot ru
28-Jun-2001 11:57

I just did the simple thing -

<?php
function du($dir)
{
  
$du = popen("/usr/bin/du -sk $dir", "r");
  
$res = fgets($du, 256);
  
pclose($du);
  
$res = explode(" ", $res);
  
   return
$res[0];
}
?>


 

 
  © 1996-2012 & Reporter.plmiejscao serwisieabonamentwarunki korzystaniaRSSkontakt