$size = trim(exec("stat -Lc%s {$escapedPath}")); } // If the return is not blank, not zero, and is number if ($size and ctype_digit($size)) { return (string) $size; } } return false; } /** * Returns file size by using Windows COM interface * @see http://stackoverflow.com/questions/5501451/php-x86-how-to-get-filesize-of-2gb-file-without-external-program/5502328#5502328 * @return string | bool (false when fail or COM not available) */ protected function sizeCom() { if (class_exists("COM")) { // Use the Windows COM interface $fsobj = new COM('Scripting.FileSystemObject'); if (dirname($this->path) == '.') { $this->path = substr(getcwd(), -1) == DIRECTORY_SEPARATOR ? getcwd() . basename($this->path) : getcwd() . DIRECTORY_SEPARATOR . basename($this->path); } $f = $fsobj->GetFile($this->path); return (string) $f->Size; } } } BigFileTools::init(); class BigFileToolsException extends Exception { }