in reply to Re: Help! Stuck on methods to count file size.
in thread Help! Stuck on methods to count file size.

It's great post! It works nicely! But I need the file name following the max size too if possible... So much appreciated:-)
  • Comment on Re^2: Help! Stuck on methods to count file size.

Replies are listed 'Best First'.
Re^3: Help! Stuck on methods to count file size.
by Anonymous Monk on Oct 11, 2013 at 02:30 UTC
    I need pancakes
Re^3: Help! Stuck on methods to count file size.
by Lennotoecom (Pilgrim) on Oct 11, 2013 at 04:13 UTC
    well, then you should add another element "name" into the hashes
    and in the while-cycle if current max is found rewrite it,
    exactly the same as the 'max' itself
      I should let you know this morning I got the result as following:
      Jan bytes 548725 files 355 max 87710 name filename01 Feb bytes 24031383 files 527 max 11223344 name filename03
      Thank you greatly!
      Super Monker, please allow me to ask you for further advise of how can I count the uncompressed size of the files in each month in Julian order? As of if we know the ratio of the uncompressed file size is the file size * 2, it'll make the process much easier. Suppose add something in the code as below:
      (${$m[$day]}{'bytes'} += $value, *2${$m[$day]}{'files'})
      Or something as the likes...
        This part:
        ${$m$day}{'bytes'} += $value
        summing your bytes, and this part:
        ++${$m$day}{'files'}
        counting the amount of processed files.
        So if you wish to double your bytes you should do:
        ${$m$day}{'bytes'} += (2* $value)
        while(<DATA>){ ($day, $value, $name) = split / /; print "$day $value\n"; ${$m[$day]}{'max'} < $value ? (${$m[$day]}{'max'} = (2* $value), ${$m[$day]}{'bytes'} += (2* $value), ++${$m[$day]}{'files'}):( ${$m[$day]}{'bytes'} += (2* $value), ++${$m[$day]}{'files'}) ; }

        test it on some unsignificant data first.(always)
      It works very well, very much appreciated you keeping helping me!!!