How to count the size of files in a directory

From: Danield (sun_x86_at_telus.net)
Date: 12/28/03

  • Next message: Tom Kinzer: "RE: How to count the size of files in a directory"
    To: perl_beginer <beginners@perl.org>
    Date: Sat, 27 Dec 2003 23:14:32 -0700
    
    

    Hello all,

    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;
    foreach (@files2check) {
       $totalSize += (-s "$dir\\$_");
    }

    print $totalSize;

    I would like to modify it that it will count the size of all files in the directory, EXCEPT those in list or so it will count the size of files that match first 2 characters "AB" (sort of AB*)
    Can anybody advice?

    Thank you for your time.

    danield


  • Next message: Tom Kinzer: "RE: How to count the size of files in a directory"

    Relevant Pages

    • Task Scheduler Returned Error 0x2 While Running Batch File
      ... I need to run a batch script to download files via ftp. ... The script works fine on XP pro, deleting specified files from a local ...
      (microsoft.public.windows.vista.administration_accounts_passwords)
    • Re: how to tar with python
      ... if I run the below script it fails with the below error, but the files exist in the directory test ... Gabriel Genellina ...
      (comp.lang.python)