Getting File Size?

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

I know that there has to be a way to find the size of the file, but I can't seem to find it in any of my books. Let me know if you know how I can accomplish this.

Also is there anyway to find out the date modified, date created, and the rest of that mumbo-jumbo?

Thanx
VulKen
To chomp or Not To chomp. That is the question

[Edited by VulKen on 08-25-2000 at 03:09 PM]

Pimpin like a pimp with an electrofied pimpin machine!

They have: 1,587 posts

Joined: Mar 1999

the answer is yes to all ur q's, but unfortunately i can't remember how to.

what books do u have?

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

I have Perl and CGI for the world wide web(Visual Quickstart) and I have Perl Core Language.
I am probabley looking in the wrong place. Any idea what it would be under?

VulKen
[][ ][][ ][][ ][][ ][][ ] [][ ][][ ][][ ]

Pimpin like a pimp with an electrofied pimpin machine!

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

you can do this with SSI, but I can't remember the commands.

I think it was something like:

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

Unfortunately, I can't use SSI in conjunction with perl. Well inside of the perl script. So SSI wouldn't help.

I think I found out what does it, just can't figure out how to use it. Go figure.

Something like :
($size) = stat($file);
print "$size";

But it isn't working. I don't know, I've never used syntax like that.

VulKen
Click here to freeze up your computer

Pimpin like a pimp with an electrofied pimpin machine!

They have: 1,587 posts

Joined: Mar 1999

pg 131 of "Perl In A Nutshell".

They have: 568 posts

Joined: Nov 1999

from perlman pages

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);

0 dev device number of filesystem
1 ino inode number
2 mode file mode (type and permissions)
3 nlink number of (hard) links to the file
4 uid numeric user ID of file's owner
5 gid numeric group ID of file's owner
6 rdev the device identifier (special files only)
7 size total size of file, in bytes
8 atime last access time since the epoch
9 mtime last modify time since the epoch
10 ctime inode change time (NOT creation time!) since the epoch
11 blksize preferred block size for file system I/O
12 blocks actual number of blocks allocated

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.