RE: How to count the size of files in a directory

2003-12-28 Thread Shawn McKinley
Hello, How about: use strict; my $dir='c:/test'; my $match='^AB'; opendir(D,$dir) or die "Can't open $dir: $!\n"; my @files=readdir(D); close(D); my $totalsize=0; for(@files) { next if(!/$match/); $totalsize+=(-s "$dir/$_"); } print $totalsize,$/; Shawn -Original Message- From:

Re: How to count the size of files in a directory

2003-12-28 Thread Rob Dixon
Danield wrote: > > I do have a beautiful script, that counts a size of specified files > ("ABAA.txt", "ABAC.txt") in a directory test. I have got this script > from discussion board. > > Here is the script: > > my $dir='c:\\test'; > my @files2check = ("ABAA.txt", "ABAC.txt"); > > my $totalSize= 0;

RE: How to count the size of files in a directory

2003-12-27 Thread Tom Kinzer
not sure if you meant except those that match...in that case, replace the if with unless. -Tom Kinzer -Original Message- From: danield [mailto:[EMAIL PROTECTED] Sent: Saturday, December 27, 2003 10:15 PM To: perl_beginer Subject: How to count the size of files in a directory Hello all,