Dermot wrote:

<snip>

This will only give you the top level of directories:

07/02/2009  14:00    <DIR>          .
07/02/2009  14:00    <DIR>          ..
07/02/2009  14:00    <DIR>          bin
15/03/2006  22:14    <DIR>          eg
07/02/2009  14:00    <DIR>          html
15/03/2006  22:15    <DIR>          lib
27/04/2005  21:32    <DIR>          site

A better solution would show you all the sub-directories. Something to
think about.

How about:

C:\home>type test.pl
my ($bytes) = qx(dir /s C:\\IndigoPerl\\perl)
  =~ /.+File\(s\)\s+(.+?)\s+bytes/s;
$bytes =~ tr/0-9//cd;
print "The acc. size of the files in my Perl installation is:\n",
      "  $bytes bytes\nor\n  ", sprintf('%.1f', $bytes/1024**2),
      " MiB\n";

C:\home>test.pl
The acc. size of the files in my Perl installation is:
  90529266 bytes
or
  86.3 MiB

C:\home>

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to