#!/usr/bin/perl
#
# Name: statdemo.pl
# Author: Chris Hedemark <[EMAIL PROTECTED]>
# Purpose: Demonstrate use of the stat() function.
# Usage: perl statdemo.pl filename1 filename2 filename3...
if (!@ARGV) {
die "No arguments!\n";
}
for ($i = 0; $i < @ARGV.""; ++$i) {
if (-e $ARGV[$i]) {
@fileinfo = stat($ARGV[$i]);
print "Size of $ARGV[$i]: $fileinfo[7]\n";
}
else {
print "File $ARGV[$i] does not exist!\n";
}
# Sample output:
#
# [chrish@shrimp perl]$ perl statdemo.pl bogus.file
/boot/vmlinuz-2.2.16-3smp /etc/smb.conf /bin/mail
# File bogus.file does not exist!
# Size of /boot/vmlinuz-2.2.16-3smp: 648343
# Size of /etc/smb.conf: 10846
# Size of /bin/mail: 62384
# [chrish@shrimp perl]$
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 6:18 AM
Subject: file size
> Hi,
>
> I would like to know if with a perl script you can get the size of a file
?
> I need to get all the size of 250 files on 250 computers ...
>
> thanx
>