Re: FW: looking for two remote functions
| From: | Myron Turner | Date: | Sun, 11 Mar 2007 12:21:13 +0000 |
| Subject: | Re: FW: looking for two remote functions | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250223@lists.php.net to get a copy of this message | ||
Myron Turner wrote:
Tijnema ! wrote:# get_len.pl use strict; use Fcntl; sysopen (FH, $ARGV[0], O_RDONLY) or die "\n"; my $buffer; my $bytes_read = 0; my $offset; while($bytes_read = sysread(FH, $buffer, 8192, $offset)) { $offset+=$bytes_read ; } print $offset,"\n"; From an exec() you'd call it with the file name:On 3/10/07, Németh Zoltán <znemeth@alterationx.hu> wrote:Actually if right click on any file or folder on a machine you2007. 03. 10, szombat keltezéssel 12.42-kor Riyadh S. Alshaeiq ezt írta:there are two values (Size on disk & Size). Files and folders arewill see thatthe disk in what is called clusters (a group of disk sectors).stored onrefers to the amount of cluster allocation a file is taking up,Size on diskfile size which is an actual byte count. As I mentioned before what I want is a function for getting thecompared tothe Size no for Size on Diskresult forTh I wrote a small perl script which returns the bytes read when a file is read from the disk and it, too, agrees with the filesize and header sizes. In Windows, the actual filesize is also returned by filesize and stat, not the size on disk (filesize uses stat). Also, in the PHP manual, the fread example uses filesize to set the number of bytes to read: || Here's the perl script:okay then what about this?use strict; use Fcntl; sysopen (FH, "index.htm", O_RDONLY); my $buffer; my $len = sysread(FH, $buffer, 8192,0); print $len,"\n";If you are really anxious about size you can exec out to this script and get the file size. -- Sorry the above version of the script was hard-coded for a small test file. Here's the general version:
perl get_len.pl <filename>$len = exec("perl get_len.pl $filename"); _____________________ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/